Repository navigation
Plan arming and the live voice path, and let field keys play tracks in unison (arming.md chunk 1) - #189
Conversation
…n unison Two plans. arming.md: you arm the tracks you name; field keys plays every armed MIDI track's instrument in unison, and field record will record every armed track, audio and MIDI, in one pass, with a lasting arm in a later chunk. live-supercollider.md (draft): an input window kind and live tracks in the daemon, fed by a shared-memory ring from an scsynth plugin, so a voice is heard through the effects above its track. arming.md chunk 1. field keys takes any number of targets: an instrument as before, or a track, which plays the instrument its record entry names, or the one MIDI track under a bus; a bus with several lists them and stops. src/keys/targets.ts resolves them and now holds resolveInstrument and the shelf listing. The voice host loads every armed program from FIELD_INSTRUMENTS, renames each SynthDef for its place, and starts a voice from each on every key. The instrument's line names each track and says when the effects above it are not heard yet.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 11m 40s over 2 heads
This change plans arming, which lets you choose the tracks that field keys plays and field record records together, and the live path that would put a track's effects on what you play. It builds arming's first chunk. field keys takes several targets. A target with track: in it resolves to the MIDI track it is, or to the one MIDI track under it, and the voice host plays every resolved instrument in unison, with each program's SynthDef renamed for its place in the list. The change knowingly leaves effects unheard: the voice still plays straight to the device, and the instrument's line says dry until live-supercollider lands. Recording several tracks and a lasting arm are later chunks.
2 finding threads: 0 resolved, 2 open
Covered 10 of 10 changed files; no generated files.
- The head moved during the review. It went from
8e02475toe22af1e, a rebase onto the updatedkeys/voice-reload-mod.git range-diffshows the pull request's own commit unchanged, and every check below ran ate22af1e. - Nothing played sound. I did not start a voice host,
scsynth, orfield keys. Insclangwith no server, I loadedjuno.scdandbass.scdthroughsc/voice-load.scdand the new renaming, and parsed aFIELD_INSTRUMENTSlist whose paths hold a space, a double quote, and non-ASCII letters. Both loaded asfield0_junoKeyandfield1_bassKey, and three programs that share the def namebassKeycame out as three distinct names. Criterion 4, two instruments sounding one key, is still owed by ear, as the plan says. - CI was still running when this review was written: the
linuxandwindowsjobs had not finished.
Ran at e22af1e, in a scratch worktree: pnpm install --frozen-lockfile, pnpm typecheck (passes), pnpm exec vitest run src/keys src/commands/keys (92 passed, 8 skipped, which are the native helper tests that need a built helper), and project check (plans valid; the one warning, about .github/workflows/projector-site.yml, is already on main). Both findings were reproduced by calling resolveKeysTargets from the build on a copy of examples/bloom with added tracks.
How the plans fare against the readiness rule:
armingisin-progress, and nothing in it blocks. Each of its three open questions is deferred explicitly: where a lasting arm lives (Justin decides before chunk 3), loop takes on several tracks (deferred until someone loops a pass with two parts), and routing MIDI by channel (deferred until a controller with split zones is in use).live-supercolliderstaysdraft, so it claims no readiness. Its three questions, the transport, live tracks while the transport is stopped, and several armed tracks under one bus, do not gate this change.- No settled decision is reversed. keyboard-instrument.md §3 "Straight to the device" hands putting the voice in the graph to live-supercollider and says the voice host's interface stays the same, which the draft plan keeps. recording.md §8 leaves host monitoring as future work, and the draft's rollout step 4 is that work.
Several targets share one voice host. Quitting stops every program watcher and closes that host. A rate restart adds every renamed SynthDef again through addAll. A reload loads every program and keeps them all when one fails. No Event literal or Event key is added, so the voicer's rule against names that collide with Event methods still holds.
Suggestions
src/keys/targets.ts:111: theexistsSync(program)branch cannot run.resolveRecordTargetcallsloadValid, which already refuses a record entry whose instrument file is missing, withinstrument file not found: shared/instruments/nope.scd. Drop the branch.sc/voice-host.scd:13andsrc/keys/voice-host.ts:205: the comments say/field/reloadloads "the program" again. It loads every program again, and keeps them all when one fails, so say that.docs/architecture.md:193: it still calls live-supercollider's work "scsynth as a node in that graph, receiving timestamped OSC". The rewritten plan keepsscsynthin its own process and brings its audio in through aninputwindow, so describe that, or point at the plan without naming a mechanism.src/commands/keys.ts:225: no test coversarmedNameor the dry note, thoughdocs/keys.mddocuments the exact line. A test beside the status-line tests insrc/commands/keys.test.tswould pin it.
…to the instrument line From the review of #189. midiTracksUnder keys the MIDI tracks it finds by name and merges the effects of every path that reaches one, so a bus that places its one MIDI track twice plays it rather than refusing two; resolveKeysTargets merges the effects of every target that reaches a track, in either order. Plan §2.1 describes the line and the reload the code has. From its suggestions: the unreachable program check is gone, the reload comments say every program reloads, architecture.md no longer names a mechanism for live-supercollider, and instrumentState and instrumentText are tested.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · took 1m 27s
This change plans arming, which lets you choose the tracks that field keys plays and field record records together, and the live path that would put a track's effects on what you play. It builds arming's first chunk. field keys takes several targets. A target with track: in it resolves to the MIDI track it is, or to the one MIDI track under it, and one voice host plays every resolved instrument in unison. The voice still plays straight to the device, so the instrument's line says dry until live-supercollider lands. This head answers the review of e22af1e: a MIDI track that several paths reach counts once, with the effects of every path, and the plan's §2.1 now describes the line and the reload the code has.
2 finding threads: 2 resolved, 0 open
Covered 12 of 12 changed files; no generated files.
- Nothing played sound. I did not start a voice host,
scsynth, orfield keys. Criterion 4, two instruments sounding one key, is still owed by ear, as the plan says. - CI was still running when this review was written: the
linuxandwindowsjobs had not finished.
Suggestions
docs/projects/arming/readme.md:220: the §9 table of checks still lists only the first five target tests. Add the test for a MIDI track that several paths reach, and the two instrument-line tests insrc/commands/keys.test.ts.
What I checked
- Both earlier findings are fixed at this head.
midiTracksUnderkeys the MIDI tracks it finds by name and merges the effects of every path, andaddmergesunheardEffectswhen a track is armed again. On a copy ofexamples/bloom, a bus that placeskeysat[1]and[5]now armskeysonce. A bus over bothkeys-busand thekeysunder it armskeyswithkeys-busunheard.field keys creek/track:keys creek/track:keys-busand the reverse order both namekeys-bus. A bus over two different MIDI tracks still refuses and lists them. §2.1 steps 3 and 4 now matchinstrumentTextand the host's reload. - The suggestions from the last review are done. The unreachable program check is gone, and a comment says why. The reload comments in
sc/voice-host.scdandsrc/keys/voice-host.tssay every program reloads.docs/architecture.mdno longer names a mechanism for live-supercollider.instrumentStateandinstrumentTextare exported and tested. - The checks pass at
b3b9b77, in a scratch worktree.pnpm typecheckpasses,pnpm exec vitest run src/keys src/commands/keysreports 95 passed and 8 skipped (the native helper tests, which need a built helper), andproject checkfinds the plans valid. Its one warning, about.github/workflows/projector-site.yml, is already onmain. - The plans pass the readiness rule.
armingisin-progress, and each of its three open questions is deferred explicitly.live-supercolliderstaysdraftand claims no readiness. Neither reverses a settled decision: keyboard-instrument.md §3 "Straight to the device" hands the in-graph voice to live-supercollider, and recording.md §8 leaves host monitoring as future work. - Several targets share one voice host. Quitting stops every program watcher and closes that host. A rate restart adds every renamed SynthDef again. A reload loads every program and keeps them all when one fails. In
sclangwith no server,juno.scdandbass.scdloaded asfield0_junoKeyandfield1_bassKey, and programs that share a SynthDef name got distinct names. No Event literal or key is added, so the voicer's rule against Event method names still holds.
….md chunk 2) (#191) `field record` recorded one track per pass, because `field-audiod` held one arm. Singing and playing together, or two MIDI parts, took two performances. Justin asked on 2026-10-11 to record audio, MIDI, or both. This is chunk 2 of the arming plan (#189, which this is stacked on): name several tracks, and one pass records every one of them, each take starting on the same sample and landing on its own track. `field record` now takes any number of tracks. `planArm` resolves each to its record entry before anything opens, where its instrument decides MIDI or audio, and gives each audio track its `--input` in the order named: `--input 1,2`, or 1, 2, and on by default. It refuses, with a message saying why: - a track named twice; - tracks in two songs; - `--input`, `--device`, or `--loop` when every track records MIDI; - `--loop` over more than one track. One track arms exactly as before. Several arm through the daemon's `arm` with `tracks`, and every take that comes back lands, whether it arrives as an event, from the stop, or through the recordings fallback. If one take of several never arrives, `field record` exits with an error naming the track and the `field record --recover <id>` that finalizes it, as a single track's lost take always has. `field transport status` in another terminal lists every armed track, a MIDI one by the sources it hears. The daemon was the real work. Rather than rewrite the capture path, which carries the latch, count-in, punch-out mid-block, and the loop hand-off, the first armed track is the *primary*, and every one of those rules runs on it unchanged. The other tracks are *companions*, in fixed slots the audio callback reads only through atomics, so the message thread can change a slot while it is not live and nothing on the audio thread allocates. Companions start on the primary's latch, an audio companion pushes the same span of its own input, and they end with the pass. An audio track is the primary whenever one is armed, so `--until` still cuts audio on its exact sample. A MIDI take ends a block after `until`, so that messages drained late are still stamped. That stamping is now one step: a MIDI primary's companions mirror it, and an audio primary's MIDI companions run it themselves, a block after the audio ends. The pass finalizes when every take has ended. `arm` and the MIDI arm are one-entry forms of `armSet`, with their answers unchanged. `armSet` opens the MIDI sources, unstarted, before it touches the audio device, so a set refused for its MIDI or its audio leaves the device, and the arm before it, as they were. `stop` returns every manifest as `takes` beside `take`. `status.record` lists `armed` when more than one track is armed, and the MIDI `sources` whenever one of them records MIDI, so a one-track status is unchanged. `recordings` and `recover` know every take in flight. The null input presents each armed channel in order, which is how the tests tell input 1 from input 2. Docs follow the behavior. `docs/audio-engine.md` gains "Several armed tracks". `docs/cli.md` describes recording several tracks and gains the `field keys` row it never had. `docs/keys.md` shows singing and playing in one pass. Plan §10 records the chunk. It also records something found along the way: an audio punch-out against a *file* bed ends 3 samples short of `until`, with one track as with several, because a file bed's reported position runs a few samples ahead. That is older than this change, and #194 tracks it. ## Testing From the repository root of this branch, after `pnpm install`, with the native tools rebuilt from this branch (`pnpm build:native`; the daemon changed): ```sh pnpm typecheck FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm exec vitest run src/commands/record-tracks-daemon.test.ts src/commands/record-plan.test.ts FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm test ``` The typecheck passes. The two focused files pass 8 of 8, and the full suite passes 1004 with 1 skipped (the no-MIDI-source case, which runs only without a MIDI service). `record-tracks-daemon.test.ts` runs the daemon in null mode: - **Two audio tracks on inputs 1 and 2:** one take holds the sawtooth, the other the constant, with the same start and length. An input or a track armed twice is refused, and so is a loop over two. A set the daemon refuses leaves the arm before it as it was. - **An audio track and a MIDI track:** both start together, and the MIDI take holds the note. - **A punch-out at 24000 over a live session:** the audio take is exactly 24000 frames, the MIDI take ends a block later at 24000, and both land. - **Two MIDI tracks:** both hold the same notes. - **`field record` with an audio and a MIDI track:** it lands both on their own tracks, `field transport status` names both while they record, and `field check` is clean. The MIDI cases skip on Windows, which has no virtual MIDI ports, as `record-midi-daemon.test.ts` does. The existing daemon tests (`record-daemon`, `punch-daemon`, `record-midi-daemon`, `click-daemon`, `play-daemon`) all pass against the reworked daemon, which is the evidence that one track records exactly as before. A take holding the wrong input, two takes with different starts, or any of those older tests failing would mean the change is wrong. Nothing here played through a real interface. Plan criteria 6 to 8, two microphones on two inputs and a controller beside a vocal, are owed by hand. The tests leave nothing behind outside their temporary directories. <!-- projector-summary v=1 sha=30c730322c4feaded1f4b24e4deb9d056691b52c --> 📽️ **Projector summary** of 30c7303: https://field.amnes.ac/reviews/191
field keyscould play only an instrument named by its program, andfield recordrecords one track per pass, because the daemon holds one arm. Justin asked for three things on 2026-10-11. The first is to play a MIDI track, a track whose record entry names an instrument, even with no takes yet. The second is to play a track above it with effects. The third is to choose the tracks to "arm" and hear every armed track in unison, and to record audio, MIDI, or both. This pull request, stacked on #188, plans all of it and builds the first chunk.docs/projects/arming/readme.mdis the plan. You arm tracks by naming them, since both commands already take targets.field keysplays every armed MIDI track's instrument in unison.field recordwill arm each named track in the daemon, an audio track on its own input and a MIDI track on the MIDI sources, start them on one latch, and land each as its own take (chunk 2). A lasting arm, throughfield armand the UI's arm buttons, comes third, after Justin decides where it lives. Justin made the two calls that matter: you choose what is armed, and armed tracks play in unison. Section 3 records the rest as decisions with the alternatives they beat, for review. They include refusing a bus over several MIDI tracks rather than arming them all, one voice host for unison rather than one per instrument, and audio inputs in the order you name the tracks.Hearing a track's effects is the hard part. The voice plays in its own
scsynth, a track's inserts run infield-audiod, and a survey of the daemon found two obstacles: nothing carries audio between Field's processes, and a live session renders every track except the output track in full when it loads.docs/projects/live-supercollider/readme.mdwas a stub and is now a draft plan. It adds aninputwindow kind and live tracks that run in the audio callback. The voice reaches the input through a shared-memory ring written by a smallscsynthplugin. The plan weighs that against embeddinglibscsynthand against a loopback device, and leaves Justin two questions: the transport, and whether live tracks run with the transport stopped. Until it lands,field keysplays an armed track dry and says so.The chunk built here is
field keyson tracks. A target withtrack:in it is a track. It plays the instrument its record entry names, or the one MIDI track under it down itstrack:inputs; a track with several under it lists them and stops, so you name the ones you mean. Anything else is an instrument as before, so the two mix.src/keys/targets.tsresolves targets and now holdsresolveInstrumentand the shelf listing, moved fromsrc/commands/keys.tsso that nothing imports the command back. The voice host takes the programs as a JSON list inFIELD_INSTRUMENTS. It renames each SynthDef for its place in the list, so two programs that name their voices alike both play, and starts a voice from each program on every key. The voicer needed no change, because a list of synths is a voice. The instrument's line names each armed track and its program, askeys (juno) + bass (bass) live at …, and ends· dry: the effects on keys-bus are not heard yetwhen a named track has inserts above its MIDI track.Testing
From the repository root of this branch, after
pnpm install, with SuperCollider installed and the native tools built (pnpm build:native):The typecheck passes, the keys tests pass, the full suite passes 992 with 1 skipped (the no-MIDI-source case, which runs only without a MIDI service), and the plans are valid.
project checkalso warns that.github/workflows/projector-site.ymlis an earlier shape; that is onmainalready and is not this change.src/keys/targets.test.tsis the test for the new rule. It covers a MIDI track with no takes, a bus with an EQ (armed, and named as unheard), a bus over two MIDI tracks (listed, exit), a track with none under it, and several mixed and repeated targets (each armed once).To try it by hand, in
examples/bloomadd a trackmjunowhose record entry hasinstrument: juno, a trackmbasswithinstrument: bass, and a busmbuswith an EQ insert whose only input istrack: mjuno. Then:field keys creek/track:mjuno creek/track:mbassshould showmjuno (juno) + mbass (bass) live at …, and every key should sound both instruments.field keys creek/track:mbusshould showmjuno (juno) live at … · dry: the effects on mbus are not heard yet.A key that sounds only one instrument, or a line naming the wrong program, would mean the change is wrong. Delete the three tracks afterwards.
I could not listen. In place of that I ran the real voice host with two silent programs that both name their SynthDef
\quiet, and played one note from a sourcefield-audiod --keyspublished. The host went live, and reported the note's voice starting and ending with no error; it reports a start only after the start callback has run and an end only after the release has. Criterion 4, two instruments sounding one key, is still owed by ear.📽️ Projector summary of b3b9b77: https://field.amnes.ac/reviews/189