Repository navigation
Type a knob's value on the number row and glide it there, and quit field keys on Ctrl-C alone (instrument-knobs.md chunk 2) - #210
Conversation
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.7 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 14m 11s over 2 heads
This is chunk 2 of the instrument-knobs plan. In musical, the number row types the chosen knob's value in its knob file's units. Enter completes the value, and the knob glides to the nearest of its 128 controller values at the keymap's new glide speed, one control change per 40 ms tick. Period types the decimal point only while a value is open, and Esc cancels a value instead of quitting, so Ctrl-C alone quits. Chunk 3, which covers .field/keys.json, the daemon's chase, and criteria 20 and 21, is left for later. The criteria that need a kitty terminal and sound (4 to 8, 12, 14, 18, and 23) are recorded as still owed in §10.3.
1 finding thread: 0 resolved, 1 open
Covered 20 of 20 changed files; 0 generated files skipped.
The head moved from f95a11e to 78525ef during this review, when #209 gained 6a7f2a2, a fix to src/keys/knobs.test.ts's expected paths on Windows. git range-diff shows this pull request's commit unchanged, and every line this review cites reads the same at 78525ef.
This head was reviewed by reading, without running its code. The commit's git author and committer are ninjudd. Its Co-Authored-By: Claude <[email protected]> trailer, though, makes GitHub list a second author login, claude, which has only read permission on this repository. Projector's trust rule withholds trust from a head whose commit names a login without write access. So this review ran no pnpm install, pnpm typecheck, or vitest. project review setup printed "trusted" because it checks only each commit's git author, not its co-authors. project check, which is Projector's own tool reading the plans, passes at this head.
CI ran the head's code instead, and passed at 78525ef:
linux.pnpm typecheck,pnpm build,field checkinexamples/bloom, andpnpm testpassed: 1159 tests, with 29 skipped. Atf95a11eit had failedsrc/keys/voice-host.test.ts:272, which waits at most 2 seconds for a stubsclang's second reload status. This change touches neither that test norsrc/keys/voice-host.ts, and the test passes here, so that failure was a timing flake.windows.pnpm testpassed 1056 tests, with 132 skipped. Atf95a11eit had failed the two tests that #209's run failed: the--knobspath test that6a7f2a2fixes, and asrc/release.test.tstimeout.- This chunk's tests.
session.test.ts(43),commands/keys.test.ts(19),schema/keymap.test.ts(18),terminal.test.ts(16),knobs.test.ts(14),position.test.ts(12), andprint.test.ts(3) passed on both atf95a11e, apart from the--knobspath test on Windows. The patch is the same at78525ef, where both jobs pass.
Suggestions
src/keys/session.ts:72:type()writesentry.label, but nothing insrcreads it. The knob line shows the entry onsession.chosen, andcomplete()acts onthis.knobs[this.chosen]. Droplabel, or have both readers use it.docs/keys.md:705: thepanicrow says that panic releases every note, stops a held turn, and sends All Notes Off. Panic now also stops every glide, as "Type a value" says. Add that to the row.
Plan conformance
- Typing and completing. A
typekey opens an entry on the chosen knob, and the knob line shows it in the value's place with the units, ascutoff 800_ Hz.Enterclamps the number to the range and takes the controller value whose mapped value is nearest (§2.7 steps 1 to 3).800oncutofflands on 62, which maps to 809.6 Hz, against 774.0 Hz for 61. Criterion 23 holds:0.8onattacklands on 96, which maps to 0.7824 s and prints782 ms, against 0.8247 s for 97. - The glide. A glide moves
127 / glidecontroller values a second, counted from the press, so a late tick catches up. Each tick sends at most one control change per controller, and the last tick lands on the target. From 127 to 62 takes 13 ticks, as the session test asserts. A turn of the gliding knob, a panic, a keymap reload, and quitting each stop it (§2.7). Period. The session checksPeriodbefore the keymap, so it types.only while an entry is open, and that press records nothing, so its release sends nothing. A bend thatPeriodbegan stays inheldControlsand ends on the release, even if an entry opened meanwhile (§3.2).- Quitting.
isQuitno longer matchesEsc. A raw\x03andCSI 99;5ustill quit, and so does a layout whosecposition types another letter, through its base key. A sequence split across reads comes back asrest, and the next read is decoded with it prefixed, both while the daemon answers and in the play loop.Ctrl-Dquit neither before this change nor after it.Escresolves to theEscapeposition, which cancels an entry or putsCtrl-C quitson the status line (§3.1). - Other keymaps.
trackerandfourthsbind notype, so no entry opens there and.plays its note: offset 14 intracker, and a cell of the bottom row infourths. The Logic number-row controls indocs/keys.mdbind notypeeither. - Schema.
typetakes 0 to 9 or"-", and refuses".", 10, and"1".glideis at least 0 and defaults to 0.EnterandBackspaceare not bindable positions, andEscape's reserved message names the new behavior (§2.3, §2.9). - Plans.
instrument-knobsandkeyboard-instrumentare bothin-progressat prioritynow, and this change flips neither, so no open question gates it. The dated note at keyboard-instrument.md §2.4 is the one that §2.9 asks for.
…eld keys on Ctrl-C alone (instrument-knobs.md chunk 2) In musical the number row types the chosen knob's value, in its knob file's units, and Enter completes it: the knob glides to the controller value nearest the number at the keymap's glide, one control change a tick, so a take keeps the glide and any instrument answers it. Period types the decimal point while a value is open and bends otherwise, Backspace edits, and a knob key completes the value first. Esc cancels a value, or with none open says that Ctrl-C quits, and Ctrl-C alone quits. Co-Authored-By: Claude <[email protected]>
… moves The timer's comment said it runs only while a turn key is held, and its function was named tickWhileTurning, but the session ticks while a glide moves as well. A maintainer who trusted the comment and stopped the timer on a turn key's release would freeze every glide partway. The comment now names both, the function is tickWhileMoving, and the plan's §10.1 records the timer chunk 2 left.
The knob line shows an entry on the chosen knob, and completing it acts on the chosen knob too, so nothing read the label the entry carried.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.8 · model claude-opus-5-5 · effort xhigh · CLEAN · took 3m 33s
This is chunk 2 of the instrument-knobs plan. In musical, the number row types the chosen knob's value in its knob file's units. Enter completes the value, and the knob glides to the nearest of its 128 controller values at the keymap's new glide speed. Period types the decimal point only while a value is open, and Esc cancels a value instead of quitting, so Ctrl-C alone quits. Since the review of 78525ef, three commits answer that review, and the branch was rebased onto #209's 3204492. Chunk 3, criteria 20 and 21, is #212's, and the criteria that need a kitty terminal and sound stay owed in plan §10.3.
1 finding thread: 1 resolved, 0 open
Covered 20 of 20 changed files; 0 generated files skipped.
The head is trusted. The chunk 2 commit carries a Co-Authored-By: Claude <[email protected]> trailer, which names the GitHub login claude, and that login has only read access. Justin ruled on 2026-10-11 that this trailer on his own commits does not make a head untrusted, so this review ran the head's code. A live field keys session was running on the review machine, so nothing ran that boots sclang, creates a MIDI source, or opens an audio device. The seven focused test files need none of those.
Earlier findings
- The timer's comment and name are fixed.
88d4ee2rewords the comment insrc/commands/keys.tsto say that the 40 ms timer runs while a turn key is held or a glide moves. It renamestickWhileTurningtotickWhileMovingat all four sites, and nothing in the tree still names the old function. Plan §10.1 records the timer. The thread is resolved. - Both suggestions are taken.
2f0a24cdropslabelfrom the entry, and the one test that read it now expects{ text: '800' }.cd79e60adds every glide to what thepanicrow indocs/keys.mdsays a panic stops.
What moved under this pull request
git range-diff shows the rebase left the chunk 2 commit's patch unchanged, apart from one context line in src/keys/print.test.ts, where #209 now describes a knob key as moving the choice. #209's new commits change code beside this pull request's without overlapping it:
formatKnobValueprints alinknob with a fractionalstepto the step's decimal places, which only widens such a knob's value and so the entry's padding.- The knob line cuts each knob to the room the window's markers leave. An entry passes through the same cut, so it loses characters only when its knob grows wider than the terminal.
juno.knobs.yamlchanges only its comment, so800oncutoffstill lands on 810 Hz and0.8onattackon 782 ms.
Checked
- Gate.
pnpm install --frozen-lockfileandpnpm typecheckpass atcd79e60. Vitest passes all 127 tests in the seven changed test files:session.test.ts(43),commands/keys.test.ts(20),schema/keymap.test.ts(18),terminal.test.ts(16),knobs.test.ts(15),position.test.ts(12), andprint.test.ts(3).project checkpasses. - CI.
linuxandwindowsboth pass atcd79e60. - Typing and the glide.
Enterclamps the number to the knob's range and takes the nearest controller value. A glide moves by the time since it started, at most one control change per controller a tick, and lands on its target: 127 to 62 atglide: 1takes 13 ticks. A turn of the gliding knob, a panic, a keymap reload, and quitting stop it. Period. It types.only while an entry is open, and that press records nothing, so its release sends nothing. A bend thatPeriodbegan ends on its release even if an entry opened meanwhile.- Quitting. Only
Ctrl-Cquits: a raw\x03,CSI 99;5u, or the UScposition on a layout without ac. A sequence split across reads is decoded with the next read.Esccancels an entry or putsCtrl-C quitson the status line. - Other keymaps.
trackerandfourthsbind notype, so no entry opens there, and.keeps playing its note. - Plans.
instrument-knobsandkeyboard-instrumentstayin-progressat prioritynow, so no open question gates this change.
The head looks clean.
…ent, and the daemon chases it to the take's first sample (instrument-knobs.md chunk 3) (#212) A MIDI take records only the messages that arrive once it has started. So a knob you turned before pressing record, such as `juno`'s cutoff dialed down for a darker pad, played live but rendered at its default in the take until you happened to turn it again. The same gap hit the modulation wheel, and keyboard-instrument.md §14.5 left it open. This third chunk of the instrument-knobs plan (#202) closes it in the daemon, with MIDI alone, so it works for any source. There are three parts: - **`field keys` publishes what it has sent.** Run inside a project, it keeps every controller from 0 to 119 it has sent, by channel, in `.field/keys.json`, written to a temporary file and renamed over the last on each control change, and removed when it quits. A `field keys` removes the file only if it wrote it, so two in one project do not delete each other's. One that cannot write the file keeps playing and names the error on the status line, and a take then starts without its knobs. - **`field record` passes them in `arm`.** When it arms a MIDI take, in the one-track form or with `tracks`, and the `field keys` that wrote the file is still running, it adds `controllers` to `arm`. It does so only for a daemon that lists the new `midi-chase` feature, so an older daemon never sees the field. - **The daemon chases controllers.** From the arm, it keeps the latest value of each controller from 0 to 119 on each channel: the ones `arm` passed, then every control change that arrives, a count-in included, whether before the take, during it, or past its `until`. Before this change it dropped those that arrived before the start. At the take's first sample it writes one line per channel and controller at `at: 0`, ahead of every other line, in the order the values last arrived, in each MIDI take of the pass. Controllers 120 to 127 are channel mode messages and are never chased. A hardware knob moved after the arm counts too. A change the take records enters the table only after those lines, so a second take on one arm, which arming.md chunk 3's lasting arm will make, starts each controller where the first take left it. On the audio thread, the chase is a fixed table of 16 channels by 120 controllers, updated in constant time per message wherever the callback used to discard arrivals before the start. `arm` hands its seeds to the callback under a spin lock that the callback only ever tries, so it never blocks, and each arm starts the table over. The lines go in just before the take's first stamped message. So an arrival in the start block that falls before the start sample is chased before the lines are written, and the lines still lead the file. `arm` refuses `controllers` out of range, as it refuses a bad input channel. A block whose pull ran before `record`'s request, which #204 lets wait for the next block to start the take, chases what it drains too, because that arrived before the start. #209 and #210, chunks 1 and 2, are on `main`, and this branch is rebased onto it, #213's host monitoring included. `armSet` takes the chase's seeds and then #213's connection `owner`, and the `tracks` form of `arm` passes both. With this, every chunk of the plan is built, and what remains is the criteria to check by hand. §11 of the plan records what implementation settled. ## Testing I ran these on macOS, from the root of a checkout of this branch, after `pnpm install`, `pnpm build`, and `pnpm build:native`. `pnpm build:native` matters here, since this change is in the daemon. Against a daemon built before it, the `midi-chase` tests fail on `client.supports('midi-chase')`. 1. `pnpm typecheck` prints nothing and exits 0. 2. `pnpm vitest run` reports 91 test files, 1216 tests passed and 1 skipped. 3. `pnpm vitest run src/commands/record-midi-daemon.test.ts src/commands/record-plan.test.ts` passes 16 tests and skips 1, which runs only where there is no MIDI service. The daemon tests publish a CoreMIDI source of their own, `Field Keys Capture <pid> …`, for a few seconds, and arm a daemon of their own in null-output mode; they touch no running daemon. The chase test seeds `cc 110 = 10` and `cc 111 = 20` on channel 16 at the arm. Before the start, it sends `cc 112 = 30` on channel 15, `cc 110 = 40` on 16, and CC 120; after the start, `cc 111 = 50`. The take's lines at `at: 0` must be `cc 111 = 20`, `cc 112 = 30`, `cc 110 = 40`, in that order, with no CC 120, and `cc 111 = 50` must land later at its own time. Lines in another order mean the chase no longer orders by last arrival. A `cc 110 = 10` line means a seed was not replaced. The `field record` test publishes `.field/keys.json` as its own process and checks that the landed notes file has `{ at: 0, cc: 113, value: 23, channel: 16 }`. The latch test sets `FIELD_AUDIOD_LATCH_STALL_MS=8` and sends a controller just before each of ten `record`s on one arm. "the controller sent before take N: expected [] to have a length of 1" means a block whose pull ran before `record`'s request dropped what it drained instead of chasing it. The carry test records twice on one arm, with `cc 114 = 20` before the first take and `cc 114 = 50` during it, and the second take's line at `at: 0` must be `cc 114 = 50`. `cc 114 = 20` there means a change the take recorded never reached the chase. What I could not run is criteria 20 and 21 by hand, which need a kitty terminal and ears. From `examples/bloom`, give `creek` a track `keys` with `instrument: juno`. In one terminal, run `node ../../dist/cli.js keys juno` and turn `cutoff` down. In another, run `node ../../dist/cli.js record creek/track:keys --at 17`, play without touching a knob, stop, build, and play. The take should render dark from its first note, and its notes file's first `controls` row should be `{ at: 0, cc: 74, value: … }`. Both terminals need this branch's `dist` and daemon: a daemon left running from another build answers without `midi-chase`, so run `field transport quit` first. With `--count-in 1`, turning `res` during the count-in should start the take with that `res`. <!-- projector-summary v=1 sha=68d929f49bdbec524a494779a2cfc85fb8ff5fb9 --> 📽️ **Projector summary** of 68d929f: https://field.amnes.ac/reviews/212
Turning a knob from one end of its range to the other takes about 2.3 seconds of holding an arrow, and landing on a particular value means watching the line and letting go in time. This second chunk of the instrument-knobs plan (#202) lets you type the value instead. In
musicalthe number row types the chosen knob's value, in the units its knob file names, so800oncutoffmeans 800 Hz and0.8onattackmeans 800 ms.Entercompletes it, and the knob glides to the controller value nearest the number, since a controller carries only 128 values:800lands on810 Hz.The glide is a run of control changes, one every 40 ms at most, at a speed the keymap's new
glidefield sets: the seconds a value takes to cross a knob's whole range.musicalsets one second, and a keymap that never mentionsglidesets a typed value at once. Because the glide is MIDI, a take keeps it and any instrument answers it, which a longer lag inside the instrument could not do..was the bend up's key in chunk 1, soPeriodtypes the decimal point only while a value is open, as #202 recommended and Justin merged. With no value open it still bends, which is why a value cannot start with..Backspaceedits a value, and a knob key completes it first, the way moving off a cell completes it in a spreadsheet. Notes keep playing while you type, so you can type over a held chord.Escnow cancels a value instead of quitting, and with no value open it putsCtrl-C quitson the status line.Ctrl-Calone quits, and no keymap can bindEscor aCtrlchord, so no keymap can trap you still. This amends keyboard-instrument.md §2.4, which now carries a dated note pointing at the plan.Enter,Backspace, andEscapeare positions the session handles before the keymap, from the kitty protocol'sCSI 13 u,CSI 127 u, andCSI 27 u.This stacks on #209. §10 of the plan records what implementation settled.
Testing
I ran these on macOS, from the root of a checkout of this branch unless a step says otherwise, after building as #209's Testing section does (
pnpm install,pnpm build,pnpm build:native).pnpm typecheckprints nothing and exits 0.pnpm vitest runreports 90 test files, 1191 tests passed and 1 skipped. A failure insrc/keys/session.test.ts's "typing a knob's value" tests,src/commands/keys.test.ts's "typing on the knob line", orsrc/keys/terminal.test.ts's quitting tests points at this change.examples/bloom,node ../../dist/cli.js keys --printdrawsmusicalwith1to0and-on the number row and lists each astype <c> into the chosen knob's value.I also drove
field keys --knobsin a pseudo-terminal, sending the kitty protocol's bytes, against a stand-in forfield-audiod --keysthat logs every message it is sent and publishes no MIDI source. The knob file hadjuno'scutoffandattack. What it showed:800readcutoff 800_ Hz, andEnterglided CC 74 from 82 down to 62, five values a tick, to810 Hz(criterion 4).12,Backspace,5read15_ Hz. The firstEscclosed it and left810 Hz, the second putCtrl-C quitson the status line, andCtrl-Cquit with All Notes Off (criterion 6).300andArrowRightglided to301 Hzand moved the choice (criterion 7).0,.,8read0.8_ sand landedattackon782 ms, and.with the value closed sent a bend up and its release (criterion 23).The stand-in is a 15-line Node script that prints
{"ready":true,"name":"Field Keys"}and appends each line it reads to a log; pointFIELD_AUDIODat it to repeat the run without a MIDI source.What I could not run is anything by ear or in a real kitty terminal: criteria 4 to 8, 12, 14, 18, and 23 by hand. From
examples/bloomin Ghostty or iTerm2, runnode ../../dist/cli.js keys juno, hold a chord, choosecutoff, type800, and pressEnter. The filter should close over about half a second while the line runs down to810 Hz. A line that jumps straight there meansglidedid not load frommusical, and a chord that stops when you type means the number row is still playing notes.📽️ Projector summary of cd79e60: https://field.amnes.ac/reviews/210