Repository navigation
Carry a live input up through every chain above its track (live-supercollider.md chunk 1) - #196
Conversation
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 19m 45s
This change is chunk 1 of live-supercollider. A live session can now carry an input window, a source outside the session that the daemon reads every block. compileSession keeps an input's track and every track above it out of the freeze. The engine runs the plan's new overlay: the song renders as before, and the input passes through a second instance of each chain on its path into main's mix, ahead of main's own chain. Only field-audiod --render-live --input feeds an input today, and the daemon's session op refuses one until chunk 2 brings the ring. The plan moves from draft to in-progress at now.
1 finding thread: 0 resolved, 1 open
Covered 10 of 10 changed files; none are generated.
The full vitest suite did not run locally. CI ran it at this head. Linux passes, with live-input.test.ts running rather than skipped. Windows fails 12 tests in record-midi-daemon.test.ts and voice-host.test.ts, every one also failing on main's latest run, and passes live-input.test.ts.
Readiness gate. The plan moves from draft to in-progress, so this change owns every question open in §7, and none blocks:
- Question 1, the transport, is answered: chunk 2 builds the shared-memory ring the plan recommended, and choosing the loopback prototype instead reopens it before chunk 2 lands.
- Question 2, playing while stopped, is answered: chunk 3 runs the overlay and
main's chain while the song is stopped. - Question 3, several armed tracks under one bus, is explicitly deferred to arming.md chunk 3. The engine already sums several inputs on one bus.
Questions 1 and 2 rest on Justin starting the work rather than on a written choice, and the plan says so plainly. The amendments to §2 and §2.2 change only this plan's design and reverse no recorded decision. The freeze still serves a cached stem only for a clean subgraph, and a subgraph carrying a live input is never clean. keyboard-instrument.md §2.6 still describes the voice going straight to the device, which stays true until chunk 3.
Suggestions
src/audiod/live-input.test.ts:44: the tone peaks at 0.51 aftervoice's EQ, under both limiters' ceilings (0.79 and 0.89), so the golden runs both limiters as pure delays and never tests gain reduction, which criterion 1 names. Scaled by 2.5, the tone drivesvoice's limiter to its ceiling, and the comparison still holds sample for sample at 145 samples; I ran it at this head.native/audiod/src/live.cpp:373:readscapturesthisand never uses it, and the build at this head prints a new-Wunused-lambda-capturewarning there.native/audiod/src/live.cpp:816: each limiter stage allocates its output vectors every block,out (2)and thenpush_backgrowth inside the limiter.main's chain already does this at the base, and the overlay adds one such stage to the audio callback for each limiter on an input's path. A preallocated output per stage would keep the callback off the heap, asLiveInput's contract asks of sources.docs/projects/live-supercollider/readme.md:201: §9 does not say what the overlay does across a session swap or a gain ramp, and both become audible once chunk 3 attaches an input in the daemon. A swap builds the overlay cold in the new session, so the input goes silent for its path latency and its tails end. A ramp on one ofmain's placements moves the overlay's gain at once, becauseaddScaledreadswindow.gainDb, while the song glides.
Ran at this head
- Native build.
field-audiodbuilt from this head against JUCE 8.0.4. - Gate.
pnpm install --frozen-lockfile,pnpm typecheck, andproject checkpass.project checkprints only its standing warning about the site workflow. - Focused tests.
live-input.test.ts,live-session.test.ts, andsrc/graph/live.test.tspass 18 of 18 against that build, including the byte-exact golden, which compares samples 145 to 24,144 of the live output with the first 24,000 of the offlinemainstem and finds no difference. - Reproductions. Two scratch goldens, deleted afterwards, built the topologies in the finding and confirmed the offset to within float rounding.
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 22m 11s
This change is chunk 1 of live-supercollider. A live session can carry an input window, a source outside the session that the daemon reads every block. compileSession keeps the input's path out of the freeze, and the engine runs the plan's overlay: the song renders as before, and the input passes through a second instance of each chain on its path into main's mix, ahead of main's own chain. Since the last review, every feed into an overlay track waits in a delay line for the track's longest incoming path. A ramp glides the overlay with the song, and a limiter stage no longer allocates in the callback. Only field-audiod --render-live --input feeds an input today, and the plan moves from draft to in-progress.
1 finding thread: 1 resolved, 0 open
Covered 10 of 10 changed files; none are generated.
The full vitest suite did not run locally. CI ran it at this head. Linux passes, with live-input.test.ts running all 5 tests. Windows fails 12 tests in record-midi-daemon.test.ts and voice-host.test.ts, every one also failing on main's latest run, and passes live-input.test.ts.
Suggestions
src/audiod/live-input.test.ts:152:crushreceivesvoiceat −6 dB, at most 0.40 against its 0.79 ceiling, so the limiter on the longest path never reduces gain in the new golden; onlyvoice's andmain's do. Sending at 0 dB, or loweringcrush's ceiling, would hold that limiter to the offline one under reduction too. §10 and the PR body say the limiters reduce gain without saying which.
What I checked
- The finding is fixed.
buildOverlaygives each overlay track an incoming and an outgoing latency, children first. Each input waits the track's incoming latency, and each edge waits that minus its arrival: the child's incoming latency for a pre-tap, its outgoing latency for a post edge. I rebuiltfield-audiodfrom this head and re-ran both reproductions from the finding with--render-live. The post send into a limiter bus and the pre-tap send under a limiter both now equal the offline stem sample for sample, 145 samples late. The thread was already resolved, and this head addresses it. - The new golden holds. A replica of the split golden matches the offline
mainstem exactly at 290 samples. Measured on the offline stems,voice's limiter reaches its ceiling andmain's reduces gain on the summed paths, whilecrush's passes its input untouched. - The callback stays off the heap.
passThroughinserts into, copies out of, and erases from vectors reserved at build, and a limiter stage writes intoscratch, reserved at build, then copies back into the working block, all within those reserves for blocks up to 16,384 samples. Nothing new takes a lock. - Ramps and swaps.
renderOverlaytakes the block's clock and evaluatesrampedGainper sample on the same unwrapped timeline asmixInputBlock. §9 now says a swap builds the overlay afresh and defers to chunk 3 whether that gap is acceptable, which the readiness gate accepts as an explicit deferral. - Readiness gate. The plan moves from
drafttoin-progress. §7 questions 1 and 2 are answered as the plan recommended, and question 3 is deferred to arming.md chunk 3. No question blocks, and no recorded decision is reversed. - The rest at this head. The earlier suggestions are taken: the tone is 2.5 times louder, and the unused capture is gone, with no warning from
live.cpporlive.hin the build.pnpm install --frozen-lockfile,pnpm typecheck, andproject checkpass.live-input.test.ts,live-session.test.ts, andsrc/graph/live.test.tspass 19 of 19 against the new build. The docs match the code:docs/audio-engine.mdand §9 say the input reachesmainlate by its longest path.
344a9f1 to
b887b68
Compare
Every project plan opened with a `# Plan: …` heading. The prefix says nothing the reader doesn't already know: each one lives under `docs/projects/`, and the `project` command already labels it as a project. Because Projector takes a project's title from its first heading, the prefix also filled every row of `project list` and the project site with the same word, which made the titles harder to scan. This change removes the prefix from all 51 plans that had it. `daw-features` never had one. Three headings started with an ordinary lowercase word once the prefix was gone, so they now start with a capital: "The UI, first version", "The TUI" and "Hosted plugins — AU and VST3 as inserts". Headings that start with a name the docs keep lowercase stay as they were: `bloom`, `prettier`, `src/engine` and the backticked `field` commands. Projector's own templates never add the prefix. It was a habit in this repository, and new plans picked it up by copying the existing ones. Once this merges, `main` has no plan left to copy it from. This change covers only plans that already exist on `main`. Two open PRs add new plans that still carry the prefix, because their authors copied it from `main`: #185 adds `install` (`# Plan: Install and upgrade`) and #202 adds `instrument-knobs` (`# Plan: Instrument knobs`). Each needs the same one-line fix on its own branch. The other open PRs that edit plans (#196, #197, #198, #201) change plan bodies but not headings, so they merge cleanly on top of this. ## Testing From the repository root, with nothing to build first: ```sh grep -rn "Plan: " docs/projects project list project check ``` `grep` should print nothing. `project list` should show titles such as `Arming` and `The UI, first version`. A title that still begins with `Plan:` means a heading was missed. `project check` should print `Project plans are valid.` It also prints a `site-workflow-outdated` warning, which `main` already shows and which this change does not touch. None of the commands change any files.
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 20m 05s
This change is chunk 1 of live-supercollider. A live session can carry an input window, a source outside the session that the daemon reads every block. compileSession keeps the input's path out of the freeze, and the engine runs the plan's overlay: the song renders as before, and the input passes through a second instance of each chain on its path, with every feed into a track delayed to the track's longest incoming path, into main's mix ahead of main's own chain. This head rebases onto main, which brought in #195's field keys status line and touches none of this change's files. It also makes crush's limiter in the two-path golden reduce gain: the send is now 0 dB into a −6 dB ceiling, and the test checks both stems' levels. Only field-audiod --render-live --input feeds an input today, and the plan moves from draft to in-progress.
1 finding thread: 1 resolved, 0 open
Covered 10 of 10 changed files; none are generated.
The full vitest suite did not run locally. The native sources at this head are identical to those of 344a9f1, which I built and reviewed, so the focused tests ran against that build rather than a new one. CI ran the full suite at this head. Linux passes, with live-input.test.ts running all 5 tests. Windows fails 12 tests in record-midi-daemon.test.ts and voice-host.test.ts, every one also failing on main, and passes live-input.test.ts.
Suggestions
- PR body, "Paths of unequal latency": "The tone in both goldens is loud enough that every limiter reduces gain" holds for the two-path golden and not for the first one. There,
main's −1 dB limiter (0.89) receivesvoice's output, which its −2 dB limiter holds at 0.79, somain's limiter never reduces gain. A squash merge makes the body the commit message, so name the two-path golden there. docs/projects/live-supercollider/readme.md:261: the edited line runs to 94 characters in a paragraph wrapped near 72, againstAGENTS.md's rule to match the line wrapping around a Markdown edit. About two dozen prose lines across 11 files indocs/already break that rule, so it is a gap in practice rather than this change's fault.
What I checked
- The new range.
interdiffmeasured a rebase ontomainthat carried every reviewed commit over unchanged, plus 30 added and 6 removed lines in the golden and §10. It asked for a gate run, and this repository sets noreview.gate, so this is a full review. Nothing innative/differs from344a9f1. - Every limiter in the two-path golden reduces gain. I measured on the offline stems at this head.
crush's output differs from its input by up to 0.29, so its limiter acts.main's output differs from the sum of its three inputs by up to 0.58, so its limiter acts too. The live render still equals the offline stem exactly at 290 samples.crush's limiter keeps a 3 ms lookahead, so the path latencies stay 0, 145, and 290. - The test's new checks. It asserts that
voice's stem peaks above 0.6, and so abovecrush's 0.50 ceiling, and thatcrush's stem stays under that ceiling. With a 0 dB send, those two together mean the limiter reduced gain. - §10 now names all three limiters, which matches the measurement.
- Gate at this head.
pnpm install --frozen-lockfile,pnpm typecheck, andproject checkpass.live-input.test.ts,live-session.test.ts, andsrc/graph/live.test.tspass 19 of 19. None of these tests touches MIDI or a voice host. - Unchanged since the clean review of
344a9f1. The delay compensation, the callback's reserved buffers, ramps, swaps, and the readiness gate all read as before. The one finding thread stays resolved and fixed.
…collider.md chunk 1)
A session can carry an input window, {input, gain_db, pan?}, naming a source outside it that the daemon reads every block (session version 4). compileSession takes inputs and keeps each input's path out of the freeze. The engine runs an overlay: the song renders as before, and the input passes up through a second instance of each chain on its path, delayed by that chain's latency, into main's mix before main's chain. --render-live feeds an input from a file with --input name=file.wav; the daemon's session op refuses one until chunk 2 gives it a source.
The plan first had the path's tracks evaluate in place, which a track placed more than once cannot do; §9 records the overlay and what it gives up. The golden test found the compiler's limiter latency one sample short of the engine's window, and insertLatency now mirrors it.
…f the heap renderOverlay mixed each edge as it stood, so an input reaching a track two ways, through a limiter and through a pre-tap reverb send, met itself offset and comb-filtered. Each feed into an overlay track now waits in a delay line for the difference between the track's longest incoming path and its own, and a second golden holds an input reaching main at 0, 145, and 290 samples to the offline render late by 290. The tone is loud enough now that both goldens run the limiters' gain reduction. A ramp on a window the input passes through glides the overlay sample by sample, through the same rampedGain the song's windows use. Each limiter stage writes into buffers reserved at build, so neither the overlay nor main's chain allocates for one in the callback. §9 says what a swap does to the overlay.
The unequal-paths golden sent voice into crush at -6 dB, under crush's ceiling, so crush's limiter never reduced gain. crush now sends at 0 dB into its own -6 dB ceiling, with the same lookahead and so the same latency, and the test checks on the offline stems that voice's output passes that ceiling and crush's stays under it.
b887b68 to
dd1cb7a
Compare
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 11m 50s
This change is chunk 1 of live-supercollider. A live session can carry an input window, a source outside the session that the daemon reads every block. compileSession keeps the input's path out of the freeze, and the engine runs the plan's overlay: the song renders as before, and the input passes through a second instance of each chain on its path, with every feed into a track delayed to the track's longest incoming path, into main's mix ahead of main's own chain. This head rebases the branch onto main at d94b734 and changes none of the branch's own lines; the pull request body now says which golden runs every limiter into gain reduction. Only field-audiod --render-live --input feeds an input today, and the plan moves from draft to in-progress.
1 finding thread: 1 resolved, 0 open
Covered 10 of 10 changed files; none are generated.
The full vitest suite did not run locally. The native sources at this head are identical to those of 344a9f1, which I built and reviewed, so the focused tests ran against that build rather than a new one. CI ran the full suite at this head, on a merge that includes 281e6f2, and both jobs pass. Linux passes 83 test files with 1 skipped, and Windows passes 79 with 5 skipped. live-input.test.ts runs all 5 tests on each.
Suggestions
docs/projects/live-supercollider/readme.md:261: the line still runs to 94 characters in a paragraph wrapped near 72, againstAGENTS.md's rule to match the line wrapping around a Markdown edit. About two dozen prose lines across 11 files indocs/already break that rule, so it is a gap in practice rather than this change's fault.
What I checked
- The branch's own change did not move.
interdiffmeasured a rebase ontomainwith 0 changed lines in the branch's own diff. Its added and removed lines againstd94b734match its lines against4467d6fone for one. It asked for a gate run, and this repository sets noreview.gate, so this is a full review. - What the base brought in.
mainmoved through #197 (the Windows test fixes, as281e6f2), #200 (no "Plan: " prefix on project headings), #185 (install.shandfield upgrade), and #202 (the instrument knobs plan). Two of those 81 files are files this branch edits. Indocs/architecture.md, #185 rewrites the build-stamp paragraph, well away from this branch's live-supercollider note. In the plan, #200 drops the heading's prefix. Neither touches a line the branch changes. In the helpers the new tests use, #197 and #185 changed only the build remedy thatsrc/audiod/client.tsnames in an error message. - Nothing in
native/moved. The daemon at this head is the one I reviewed at344a9f1: delay compensation along unequal paths, reserved buffers in the callback, and ramps on the song clock. - Gate at this head.
pnpm install --frozen-lockfile,pnpm typecheck, andproject checkpass.live-input.test.ts,live-session.test.ts, andsrc/graph/live.test.tspass 19 of 19. None of these tests touches MIDI or a voice host. - The earlier finding and the readiness gate. The one finding thread stays resolved and fixed. The plan still answers §7 questions 1 and 2, defers question 3 to arming.md chunk 3, and defers the swap gap to chunk 3.
…hared-memory ring (live-supercollider.md chunk 2) (#198) Chunk 1 (#196) taught the live session to carry an input up through every chain above its track, but nothing in the daemon could feed one: only `--render-live`, from a file. This is chunk 2 of the live-supercollider plan: the path that carries the voice host's audio into the daemon, so chunk 3 can point `field keys` at it and the "dry" note goes away. The voice host runs its own `scsynth`, so the audio has to cross processes. Per the plan's decision, it crosses through a POSIX shared-memory ring: `FieldOut`, a small `scsynth` UGen, writes its two inputs into the ring, and the daemon reads it once per block. The daemon owns the ring. The new `input` op makes one under a name and answers its number, which is what `FieldOut.ar(ring, left, right)` takes, kept below 2^24 because every UGen input is a float. A session's input window of that name then reads it. `input_close` frees the name, while a session still reading the ring keeps it. `status` lists each open input's counters, and `hello` lists `live-input`. `FieldOut` is GPL-3.0-or-later, with its own `LICENSE` in `native/sc-fieldout`, because it builds against SuperCollider's plugin interface, which is GPL. Justin chose to keep it in this repository on 2026-10-11, and the plan records that as §11. The rest of Field stays MIT. The daemon and the plugin share only `native/ring/field_ring.h`, an MIT header holding the layout and the writer's code, and nothing links across that line. The plugin's headers are vendored from SuperCollider `Version-3.14.1`, about 180 KB, so the build needs no network and pins the plugin API. `pnpm build:native` now builds the plugin after the daemon; it is skipped on Windows, which has no POSIX shared memory, and the daemon there answers `input` with that reason. The daemon's reader, `RingInput`, is a small jitter buffer. It waits until it holds a block plus 256 frames, the block being the largest any call has asked for, so a block the session splits at a loop wrap reads against the same margin as a whole one; past a song's content the engine now renders a block whole rather than a frame at a time. It then plays one block per call. When the writer runs fast enough to hold twice that, it drops the oldest frames. When the writer stops, it plays what it has, counts an underrun, and waits to fill again. When nothing read for longer than the ring holds, so that the writer dropped frames, it skips what it held and starts at the present. Every ring is retired before the daemon's fast exit after hosting a plugin, which skips destructors. Both processes play on the same device, so drift should be rare, and the counters in `status` show it when it isn't. Whether 256 frames is the right margin is criterion 4's question, which needs the real device and waits for chunk 3. Building it turned up one constraint for chunk 3, recorded in the plan and the plugin's README. At shutdown `scsynth` unloads its plugins before it frees the synths still running, so a `FieldOut` left running crashes `scsynth` on its way out; the voice host must free it first. `src/keys/synthdef.ts` writes SynthDefs and OSC directly, without sclang, because sclang has no `FieldOut` class and installing one would mean editing every user's class library. The tests use it now, and chunk 3's voice host will use it for its routing synth. `field upgrade status` counts `native/ring` and `native/sc-fieldout` as daemon sources, beside `native/audiod`, because `field-audiod` includes the ring header and `install.sh audiod` builds `FieldOut` in the same `build:native`. Without them, a change to either reported `audiod-current`, and `docs/install.md` says so. ## Testing From the repository root of this branch, after `pnpm install` and `pnpm build:native` (the daemon changed, and it builds the plugin into `native/sc-fieldout/build/plugins/`): ```sh pnpm typecheck native/audiod/build/field-audiod_artefacts/Release/field-audiod --ring-selftest FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm exec vitest run src/audiod/live-ring.test.ts src/audiod/live-input.test.ts pnpm exec vitest run src/install.test.ts FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm test project check ``` The typecheck passes. `--ring-selftest` prints `{"ok":true}`. The two focused files pass 9 of 9. `install.test.ts` passes 36 of 36, including the case that backdates every `native/audiod` source, then commits a ring header and a `FieldOut` source and expects `audiod-stale` to name each; with the old check it reports `audiod-current`. The full suite passes 1089 with 1 skipped (the no-MIDI-source case, which runs only without a MIDI service). `project check` passes with its standing site-workflow warning. `--ring-selftest` runs `RingInput` against the writer in `field_ring.h`, the code `FieldOut` runs, interleaved the way two callbacks are, in four scenarios: - **Steady:** after priming, every frame plays once, in order. - **A stopped writer:** one underrun, then playback resumes from the frame after the last one played, with nothing lost or repeated. - **A fast writer:** frames are skipped to hold the level, and the reader never runs dry. - **No reader:** the ring fills to its 8,192 frames and the rest counts as dropped. `live-ring.test.ts` covers the daemon: - **The ops:** `input`, the refusal of a duplicate or empty name, `input_close`, and `status`. - **A session:** one whose input names no open input is refused, and one that names an open input loads and plays. - **`FieldOut` itself:** where `scsynth` and the built plugin are installed, `scsynth`'s non-realtime mode runs a sine through `FieldOut` into a ring the daemon made. The ring holds 8,192 frames with 39,808 dropped. A playing session then reads all 8,192, skipping the stale excess down to its level. That case is skipped where `scsynth` is missing, as on CI. Any of these would mean the change is wrong: a failing self-test, a `FieldOut: ring` line in `scsynth`'s output, a `written` count other than the capacity after the render, or a session that loads with an input nothing feeds. Nothing here plays through a real device. The tests leave nothing behind outside their temporary directories, and each ring is unlinked when its input closes or the daemon exits. <!-- projector-summary v=1 sha=d1e80abdddfcd0e9ae43e671f95203de34d5e781 --> 📽️ **Projector summary** of d1e80ab: https://field.amnes.ac/reviews/198
…ough FieldOut (live-supercollider.md chunk 3) (#201) When you play a track with `field keys`, you should hear it the way the song plays it, through the track's effects and the effects of every track above it up to `main`'s limiter. Until now the voice played straight to the device, and the line said "dry". This is chunk 3 of the live-supercollider plan, the one you hear. It wires `field keys` to the input path of #196 and the ring of #198, and makes the daemon play inputs while the song is stopped. When you name tracks, `field keys` asks the daemon for an input per armed track, loads the song's live session with those inputs, and starts the voice host with one ring per instrument. Each track gets a voice of its own, even when two tracks share an instrument, because each voice goes to its own ring. In the voice host, each routed instrument's voices play into a private bus, and a route synth at the tail, `In` into `FieldOut`, carries that bus into the ring. sclang has no `FieldOut` class, and adding one would mean editing every user's class library, so Field writes the route's SynthDef itself with `src/keys/synthdef.ts` and the host loads it by file. An instrument named without a track still plays straight to the device. When you quit, the inputs close and the song loads again without them. When routing isn't possible, the voice still plays straight to the device, and the instrument's line keeps the dry note with the reason: `FieldOut` not built, Windows, a daemon that predates live inputs, tracks in two songs, `--device` naming a device other than the daemon's, or a device the daemon has to convert the song's rate for. So a missing build degrades to what the line already said, never to silence. The voice host boots on the daemon's device, so the two share a clock, and `FieldOut` reaches `scsynth` through `SC_PLUGIN_PATH`, beside its own plugins. A routed voice survives the rest of Field: `field play`, its `--watch`, `field ui`, and `field record` compile in the open `keys:` inputs for their song when they load it, and `field keys`' own loads keep the loop, region, and solo another terminal set. An input closes on its own when the connection that opened it drops, so a `field keys` that fails or is killed leaves nothing open. Once the voice is live, `field keys` checks that `FieldOut` is writing its ring, and otherwise marks the line dry. A gain ramp on the routed voice glides on the overlay's own clock, so it finishes while the transport is stopped. With the transport stopped, the daemon now plays what the inputs reach, as the plan's §7 question 2 settled. It runs a second instance of `main`'s chain, so you play over silence while the song's own chain and position stay where they were; pressing play hands the input to the song's path. Each input now reports a `peak`, and `field-audiod --ring-feed <ring> <file.wav>` writes a file into a ring at real-time pace as `FieldOut` would, so an input can be checked without SuperCollider. Chunk 2 found that `scsynth` crashes quitting with a `FieldOut` still running. Every way the voice host stops now frees its nodes first: `field keys` quitting, the host's own restart for a new sample rate, and the host noticing its parent has gone. ## Testing From the repository root of this branch, after `pnpm install` and `pnpm build:native`, which builds the daemon and `FieldOut`: ```sh pnpm typecheck FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm exec vitest run src/keys/routing-voice.test.ts src/keys/routing.test.ts src/audiod/live-ring.test.ts src/keys/voice-host.test.ts src/commands/keys.test.ts FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm test project check ``` The typecheck passes. The five focused files pass, and the full suite passes 1103 with 1 skipped (the no-MIDI-source case, which runs only without a MIDI service). `project check` passes with its standing site-workflow warning. - **`routing-voice.test.ts`**, through real programs: a track is routed into the daemon in null-output mode, the real voice host starts on sclang and `scsynth` with `FieldOut`, and a note from a published MIDI source reaches the track's input. The daemon reports a peak above 0.01 while the transport is stopped. It needs SuperCollider, the built plugin, and an output device for `scsynth`, so it runs on a workstation and skips on CI. - **`routing.test.ts`:** `routeArmed` opens `keys:creek/bass` with a ring, loads `creek` with it, and on close leaves no inputs and the song loaded. It also says why when it can't route: tracks in two songs, or `FieldOut` not built. - **`live-ring.test.ts`:** a ring fed by `--ring-feed` while the transport is stopped is read through the idle path at the sine's 0.25 peak. Where `scsynth` is installed, the route SynthDef carries a private bus into the ring in non-realtime mode. - **`voice-host.test.ts`:** the host receives `FIELD_RINGS`, `FIELD_FIELDOUT`, and a route file that starts `SCgf`, routes nothing when no instrument has a ring, and sends `/g_freeAll` before `/quit`. - **`keys.test.ts`:** the instrument line drops the dry note when routed, and gives the reason when not. By hand, in `examples/bloom` with `creek`'s `bass` track given `record: {instrument: bass}` and placed in `main`: `field keys creek/track:bass` should show no dry note, and the bass should play through `main`'s limiter. `field keys creek/track:main` should do the same. I couldn't play it myself, because `field keys` needs a kitty-protocol terminal, so criterion 3, hearing it, is yours. Any of these would mean the change is wrong: a dry note with no reason, silence instead of the dry fallback, or a crash report from `scsynth` after quitting. Criteria 4 and 5 (the added latency, and an hour without a dropout) need the real device and are owed by hand. A session swap under a playing input rebuilds the overlay cold, a gap of the path's latency; §10 records that as accepted for now. <!-- projector-summary v=1 sha=b13d283245689e90b7215f1ec7eaa9aad88dcfa3 --> 📽️ **Projector summary** of b13d283: https://field.amnes.ac/reviews/201
… and map them through each instrument's knob file (instrument-knobs.md chunk 1) (#209) `field keys` could change one thing about an instrument's sound while you played: the modulation wheel, in six fixed steps on keys `3` to `8`. Everything else was fixed when the program loaded, so hearing `juno` with a darker filter meant editing `juno.scd` and saving. This change makes `field keys` a MIDI controller with knobs, as the first rollout chunk of the instrument-knobs plan (#202) describes. You choose a knob with the left and right arrows and turn it with up and down, faster the longer you hold. Every turn leaves `field keys` as a plain control change on `Field Keys`, so any instrument can answer it and a take you record keeps it. An instrument describes its knobs in a knob file beside its program, `juno.knobs.yaml` beside `juno.scd`: each knob's name, controller, range, curve, step, units, and default. `--knobs` reads a knob file for an instrument `field keys` does not play, such as a hardware synth or an instrument in Logic. One zod schema, `src/schema/knobs.ts`, checks every knob file on every path that hands one to an instrument: `field keys` at start and on each save, and a take's render in its `validate`, which is also how `field check` reports it. A knob line between the instrument's line and the status line shows every knob at a fixed width, with the chosen knob in reverse video and a window that scrolls on a narrow terminal. `musical`, Field's take on Logic Pro's Musical Typing, replaces `musical-typing` as the default keymap. It keeps every note and the octave, velocity, and sustain keys, puts the knobs on the arrows, and moves the bend to `,` and `.`. It leaves the number row free for chunk 2, which types a knob's value there. `docs/keys.md` gives Logic's number row as controls to copy into a keymap of your own. On the SuperCollider side, the voicer hands every controller from 2 to 119 except sustain to the voices as `cc<n>`, from 0 to 1, as it already handed over the wheel as `mod`, and it knows nothing about knobs. A voice maps its controls itself. `juno` and `bass` read their ranges from the copy of their knob file that Field checked, which `FIELD_KNOBS` names, so each range is written once, the recommendation #202 merged with. A knob file can leave any knob out, and a voice then keeps that setting's fixed value. Their render branches keep their bytes. Implementation settled a few things the plan left open, and §9 of the plan records them. The largest is that the copy a voice reads spells out every field with the defaults filled in, so a knob file can lean on the schema's defaults. Typing a value and the glide come in chunk 2, and a take that starts where your knobs are comes in chunk 3. Both will stack on this pull request. ## Testing I ran these on macOS with SuperCollider 3.14.1, from the root of a checkout of this branch unless a step says otherwise. Build first: ```sh pnpm install pnpm build pnpm build:native ``` `pnpm build:native` builds `field-audiod` and FieldOut into the checkout. Build them here: a daemon built before #196 fails the daemon tests with `session version mismatch`, which says nothing about this change. 1. `pnpm typecheck` prints nothing and exits 0. 2. `pnpm vitest run` reports 90 test files, 1171 tests passed and 1 skipped. A failure in `src/schema/knobs.test.ts`, `src/keys/knobs.test.ts`, `src/keys/session.test.ts`, or `src/commands/keys.test.ts` points at this change. 3. `pnpm vitest run src/keys/voicer.test.ts src/generators/voice-render.test.ts src/keys/routing-voice.test.ts` runs through real `sclang` and passes 16 tests. `routing-voice` boots `scsynth` on your output device for a few seconds. If the voicer's `cc<n>` test fails, CC 74 does not reach the voices; if the render's knob-file test fails, a take's controllers do not reach the voice through its knob file. If the render of bloom's `juno` or `bass` from a knob file with `cutoff` alone fails with `Message 'at' not understood`, a knob file without one of their four knobs stops their voice from loading. 4. From `examples/bloom`, `node ../../dist/cli.js keys --keymap musical-typing` exits 1 with `no built-in keymap named "musical-typing" (built-ins: fourths, musical, tracker)`. `node ../../dist/cli.js keys --print` draws `musical` with `K-1`, `K+1`, `R+1`, and `R-1` on the arrows. 5. From `examples/bloom`, compare `main`'s `juno` render with this branch's (criterion 19). Run the same with `bass` in place of `juno`: ```sh git show origin/main:examples/bloom/shared/instruments/juno.scd > shared/instruments/juno-main.scd node ../../dist/cli.js sc render shared/instruments/juno-main.scd --seed 1 --duration 4 --output /tmp/juno-main.wav node ../../dist/cli.js sc render shared/instruments/juno.scd --seed 1 --duration 4 --output /tmp/juno-branch.wav cmp /tmp/juno-main.wav /tmp/juno-branch.wav rm shared/instruments/juno-main.scd ``` `cmp` prints nothing. Any output means the change touched a render branch. 6. From `examples/bloom`, break `juno`'s knob file under a track that records for `juno` (criterion 22), then put both files back: ```sh printf ' - record:\n instrument: juno\n' >> songs/creek/tracks/keys.yaml sed -i '' 's/min: 50, max: 15000/min: 0, max: 15000/' shared/instruments/juno.knobs.yaml node ../../dist/cli.js check git checkout songs/creek/tracks/keys.yaml shared/instruments/juno.knobs.yaml ``` `field check` exits 1 and names `shared/instruments/juno.knobs.yaml: knobs.0.min: cutoff: an exp curve needs min and max of one sign and neither 0, not 0 and 15000`. `field build creek` fails with the same line. Silence from `field check` means the render's `validate` no longer checks the knob file. I also ran `field keys --knobs` with a one-knob file in a pseudo-terminal, with the real helper, sending the kitty protocol's bytes for `ArrowRight`, `ArrowUp` held for a second, and one `ArrowDown`. The knob line went from `mod 0 cutoff 2.00 kHz` to `cutoff 4.27 kHz` with `cutoff` in reverse video, at one width throughout, and the status line had no `mod` field. What I could not run is everything that needs a kitty terminal and ears: criteria 1 to 3, 9, 11, 13, 15 to 17, and 12 and 18 up to their typed values. Start with `node ../../dist/cli.js keys juno` from `examples/bloom` in Ghostty or iTerm2. The knob line should read `mod 0 cutoff 2.00 kHz res 0.300 attack 800 ms release 1.50 s`, and holding `ArrowUp` on `cutoff` under a chord should open the filter, faster the longer you hold. A filter that does not move while the line does means the voice is not reading `cc74`. I also did not see a turn's MIDI through CoreMIDI: your `field keys creek/track:main` was running, so `--midi-monitor "Field Keys"` attached to its source and saw none of the test's messages. `src/keys/session.test.ts` pins what a turn sends and when. <!-- projector-summary v=1 sha=320449275f9270bdc6b8c8ba89f71489941e4746 --> 📽️ **Projector summary** of 3204492: https://field.amnes.ac/reviews/209 --------- Co-authored-by: Claude <[email protected]>
field keysplays an instrument straight to the device, so a track's effects never touch what you play, andfield keyssays so with a "dry" note. The live-supercollider plan fixes that in three steps: an input in the daemon's live session, a ring that carries SuperCollider's audio to it, andfield keysrouted through both. This is the first step, chunk 1: the engine and the compiler learn what an input is, and a test proves it sounds exactly like the offline render. Justin started the work on 2026-10-11, taking the plan's two recommendations, the shared-memory ring and live playing while the song is stopped, which the plan now records.A session can carry an input window,
{input: <name>, gain_db, pan?}, naming a source outside the session that the daemon reads every block (session version 4).compileSessiontakesinputs, puts each window on its track, and keeps that track and every track above it out of the freeze, so each keeps the chain the engine needs; a sibling fed by a file still freezes into its stem. It refuses an input on a track the song lacks, on a track nothing places undermain, on a path that crosses rates, or with a name used twice.The engine runs what the plan's new §9 calls the overlay. The song renders exactly as before, and the input travels beside it: each track on its path mixes it, with each window's gain and pan, and runs a second instance of its own chain, and
mainadds the result to its own mix before its own chain, somain's inserts hear the true sum. Each chain's output passes through a delay preloaded with that chain's latency, because a limiter's lag varies from block to block. Where the input reaches a track along paths of unequal latency, such as through a bus with a limiter and through a reverb send, the shorter feeds wait in a delay line for the longest, so the input never meets itself offset and reachesmainlate by its longest path. A gain ramp glides the overlay with the song, and each limiter stage writes into buffers reserved at build, so the callback never allocates for one.The plan first had every track on the path evaluate in place, per block. Building it showed why that cannot work: a track's content sits on a timeline its placement offsets, and a track placed more than once, as creek places
phrasethree times, would need to be at several positions at once. The overlay keeps the song's render untouched, and with it the live engine's golden equivalence. What it gives up is recorded in §9: a limiter or hosted plugin on a bus between the input andmainhears the input apart from that bus's own content. Linear inserts andmain's chain are unaffected.field-audiod --render-livetakes--input <name>=<file.wav>, which is how the test feeds an input. That test also found the compiler's limiter latency,insertLatency, one sample short of the engine's window, which is the horizon at the attack slope plus the sample being pushed; it now mirrors the engine's arithmetic operation for operation. Only the session's reportedlatencyreads it today, and the overlay's delay is that number. The daemon'ssessionop refuses an input window until chunk 2 gives it a source, so nothing outside the tests can attach one yet.docs/audio-engine.mdgains "Live inputs", anddocs/build-graph.mdanddocs/architecture.mdfollow; the plan moves toin-progressatnow.Testing
From the repository root of this branch, after
pnpm installandpnpm build:native(the daemon changed):The typecheck passes, the three focused files pass 19 of 19, and the full suite passes 1084 with 1 skipped (the no-MIDI-source case, which runs only without a MIDI service).
project checkpasses with its standing warning about the site workflow file.src/audiod/live-input.test.tsholds the two acceptance criteria this chunk owns:mainwith its own limiter, and builds offline. A second song has the same chains and nothing on the track, places that track twice inmain, and plays the same tone through an input with--render-live. The live output is silent for the input track's 145-sample limiter latency, then equals the offline stem sample for sample for as long as the tone lasts: the input is heard once, through both chains, exactly. Past the tone the two part on purpose, because the stem ends with its track's content and cuts the EQ's ring there, while an input has no end.voice, which has a limiter, reachesmaindirectly, throughcrush, a second limiter, by a post send, and throughwash, a reverb, by a pre-tap send: 145, 290, and 0 samples. The live render equals the offline stem sample for sample, 290 samples late, which shows the overlay aligning every path to the longest. In this golden every limiter reduces gain:crushreceivesvoiceat 0 dB into its own −6 dB ceiling, and the test checks on the offline stems thatvoice's output passes that ceiling andcrush's stays under it. In the first golden onlyvoice's limiter does, becausemain's −1 dB ceiling sits above whatvoice's −2 dB limiter lets through.keyskeepskeysand the bus above it with their chains, and the siblingpadis still a file window over its stem; neither path track is reported dirty.main, or named twice is refused by the compiler, and--render-liverefuses a session whose input nothing feeds.The existing
live-session.test.tsgolden, a live session byte-identical to its offline stem, passes unchanged, which is the evidence that the song's own render did not move. A nonzero difference in the golden comparison, any sample before the latency, or a doubled level from the second placement would mean the change is wrong. Nothing is left behind outside the tests' temporary directories.📽️ Projector summary of dd1cb7a: https://field.amnes.ac/reviews/196