Repository navigation
Follow up on field keys: list the instruments, add juno and bass, rename the pad, and keep the notes last - #183
Conversation
field keys bass in examples/bloom said only that bass.scd was missing, which leaves you guessing at names. A miss now lists the shelf, split into the programs that play from notes and those that only render, by whether each reads FIELD_MODE: a program that never reads it cannot answer voice mode, so its text tells without starting sclang for each.
… from field keys Both are the JU-06A model from okamnesiac/offset (patches/ju06a.scd), the Roland Juno's DCO, HPF, resonant VCF, VCA, and chorus under one ADSR. juno is set to offset's classic Juno pad and bass to the bass its factory makes. Each answers FIELD_MODE=voice with a SynthDef under the voice contract, at true pitch, and otherwise renders a short demo under the sc-render contract: juno a held C minor ninth, bass offset's line from sessions/juno.scd. Each program carries its own copy of the graph, because a program's bytes are the cache key for what it renders. docs/keys.md names them, and its example of a missing name is now organ.
Each reload waits up to 5 s, but vitest's default 5 s covered the whole test, and on a loaded machine file events can arrive a second or more late; the full suite timed it out twice. The test now has 20 s.
field keys pad reads better beside juno and bass. The program's SynthDefs are padKey and padVoice; with seed 90210 and 10 s, pad.scd renders the same bytes still-water-pad.scd did on main. The pad-sc track, both READMEs, the docs, and the plan follow; the plan's verification rows in §10.3 and §13.3 keep the old name, because the runs used it, and §13.2 says so.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.3 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 19m 46s over 3 heads
This pull request collects fixes from trying the keyboard instrument after #178 to #182. When field keys <name> names a program that is not on the project's shared/instruments/ shelf, the error now lists the shelf, split into programs that play from notes and programs that only render, by whether each program's text mentions FIELD_MODE. examples/bloom gains two playable instruments, juno and bass, both ports of the JU-06A synth from okamnesiac/offset, and renames still-water-pad to pad everywhere but the plan's records of past runs. The keymap reload test gets a 20 s budget for its three reloads. The branch is meant to collect further fixes from the same testing.
1 finding thread: 0 resolved, 1 open
Covered 12 of 12 changed files; no generated files.
- The head moved twice during the review. It started at
e147fe9, moved tof74396c, and then to8447be4. I checked every finding again at8447be4, and every number below comes from8447be4unless it names another head. - The new instruments were read, not rendered. This review does not start
sclangorscsynth. So I checkedjuno.scdandbass.scdby reading them against the voice and render contracts indocs/keys.mdanddocs/build-graph.md, and againstoffset'spatches/ju06a.scdandsessions/juno.scd. Their knobs match offset's "Classic Juno pad" and the~ju06afactory's bass, and the graph matches offset's stage by stage.
Suggestions
- The reload test still fails at this head.
src/keys/keymap.test.ts:120: of eight concurrent runs of this file, three failed withno reload 1 within 5 s, which isnextReload's own deadline, so the 20 s budget cannot help them. The first save's directory event is sometimes lost rather than late, because the test saves right afterwatchKeymapstarts the watch. Under four parallel processes, 4 of 60 first reloads never arrived within 30 s, and every other reload arrived within 85 ms. The same race is at the base. Re-save the first edit every 500 ms until reload 1 arrives. Under the same load, one re-save recovered each of the 4 lost events, within 605 ms. - "Press
Z" holds only in the default keymap.docs/keys.md:169:trackerandfourthsbindZto a note and transpose on the arrows. Say "inmusical-typing", asbass.scd's own comment does. - The message points at a file the user's project does not have.
src/commands/keys.ts:67:see docs/keys.mdis a path in Field's checkout, but the message prints in the user's project, andbloomhas nodocs/directory. No other runtime message names a docs path. Point at "Make an instrument playable" in Field'sdocs/keys.md, or drop the pointer. shelfInstrumentsneeds no export.src/commands/keys.ts:46: nothing outsidekeys.tsimports it, and the test reaches it throughresolveInstrument. Drop theexportuntil a caller needs it.- The docs misstate when
.scdis added.docs/keys.md:85says a name works "with or without.scd", anddocs/project-model.md:354says "a name without.scdgets it".instrumentProgramadds.scdonly to a name with no extension, sopad.v2never namespad.v2.scd. This is already true at the base. State the rule askeyboard-instrument.md§2.1 does:.scdis added to a name that has no extension.
What I ran
All of these ran in a scratch worktree at 8447be4, after pnpm install --frozen-lockfile.
pnpm typecheck. Passes.pnpm exec vitest run src/keys/voice-host.test.ts src/keys/keymap.test.ts. Three sequential runs passed 25 of 25. Atf74396c, the same command failed once in eight sequential runs and once in eight concurrent runs, the second time in the reload test.field keys organinexamples/bloom. Exits 1 and prints exactly the listingdocs/keys.mdshows.node ../../dist/cli.js checkinexamples/bloom, the step CI runs. Printsokwithpad-scpointing atpad.scd.resolveInstrumentagainst a project whose shelf holds onlypad.v2.scd. Listspad.v2, andpad.v2then fails, as the thread describes.watchKeymapalone, 60 runs under load, timing the first reload, with and without a re-save. The numbers are in the first suggestion.
Outside a project, a bare name still fails before any listing, and a path still resolves from where you are. An empty or missing shelf prints shared/instruments/ has no programs yet.. Directories named *.scd and Emacs's dangling .#name.scd lock links are left out because Dirent.isFile() is false for both, and files that do not end in .scd are left out by name. After the rename, no file names still-water-pad except the plan's §10.3 and §13.3 rows and the note that says they keep it.
…s own line, and list dotted programs by a name that resolves Playing moved everything after the notes, so the notes are last now, and a narrow terminal shortens the text before them instead of the notes. The Playing ... Esc or Ctrl-C quits line is gone. An instrument's state has the first line to itself, redrawn in place only when it changes, so the status line holds the session and the notes. From the review of #183: the listing keeps .scd on a program whose name has another extension, so pad.v2.scd lists as a name field keys resolves. The reload test saves again every 500 ms until each reload arrives, because a watch just started can lose a directory event outright; sixteen concurrent runs pass. The listing's pointer names Field's docs, shelfInstruments is no longer exported, and the docs say .scd is added to a name with no extension and that Z drops an octave in musical-typing.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 3m 48s
This pull request collects fixes from trying the keyboard instrument after #178 to #182. When field keys <name> names a program that is not on the project's shared/instruments/ shelf, the error lists the shelf, split by whether each program's text mentions FIELD_MODE. examples/bloom gains two playable JU-06A instruments, juno and bass, and renames still-water-pad to pad. Since the last review, the status line ends with the sounding notes, and an instrument's state has its own line above it. The reload test now saves again until each reload arrives, and the listing names a dotted program by a name that resolves.
1 finding thread: 1 resolved, 0 open
Covered 13 of 13 changed files; no generated files. Since the review of 8447be4, src/commands/keys.ts, src/keys/keymap.test.ts, src/keys/voice-host.test.ts, the new src/commands/keys.test.ts, docs/keys.md, docs/project-model.md, and the keyboard-instrument plan changed. I read each of them in full at 8b9718d. The six files that did not change keep that review's reading.
- The new instruments were read, not rendered. This review does not start
sclangorscsynth, sojuno.scdandbass.scdstand on the earlier reading against the voice and render contracts and offset's sources. Neither file changed since then. - The new drawing was read, not watched. This review does not open an interactive
field keys, so the two-line drawing was checked by readingdrawand by the newstatusTexttests.
Suggestions
- Acceptance criterion 25 still looks for the instrument on the status line.
docs/projects/keyboard-instrument/readme.md:658says "the status line shows the instrument restarting and then live at 48 kHz". The state now has its own line above the status line, as §2.1 step 6 and §2.4 already say. Name the instrument's line there, unless you keep the chunk 2 rows as they were run. - "Never the notes" holds until the notes alone are wider than the terminal.
src/commands/keys.ts:248anddocs/keys.md:58promise the notes are never shortened, but when they alone pass the width,statusTextreturnsnotes.slice(0, width). That takes about 20 held keys on an 80-column terminal, so it is rare. Say "never the notes unless they alone are wider than the terminal", or keep the claim and accept the edge.
What I checked
All of this ran in a scratch worktree at 8b9718d, after pnpm install --frozen-lockfile.
- The earlier finding is fixed.
shelfInstrumentsnow keeps.scdon a program whose stem still has an extension. Against a scratch shelf,pad.v2.scdlists aspad.v2.scd,a.scd.scdasa.scd.scd, and.hidden.scdas.hidden, andresolveInstrumentaccepts each listed name. The thread was already resolved, so it needs no reply. - The reload test no longer fails under load. 32 runs of
src/keys/keymap.test.ts, eight at a time, all passed, where 3 of 8 failed at8447be4. At least 5 of the 32 took over 500 ms, so they reached the re-save and recovered through it. A re-save cannot add a reload, becausewatchKeymapignores text it already loaded. pnpm typecheck. Passes.pnpm exec vitest run src/commands/keys.test.ts src/keys/voice-host.test.ts src/keys/keymap.test.ts. 27 of 27 pass.field keys organinexamples/bloom. Exits 1 and prints exactly the listingdocs/keys.mdshows, with the new pointer to Field'sdocs/keys.md.node ../../dist/cli.js checkinexamples/bloom, the step CI runs. Printsok.- The two-line drawing. Only
drawwrites to the terminal while you play, because the helper and the voice host both run with piped output. So the cursor is always on the status line whendrawmoves up one line to rewrite the instrument's line.drawgivesstatusTextthe terminal's width less one column, at least 20, andstatusTextkeeps the line within it, so the status line does not wrap on any terminal 21 columns or wider. - The earlier suggestions. The message names Field's
docs/keys.md,shelfInstrumentsis no longer exported,docs/keys.mdsaysZdrops an octave inmusical-typing, anddocs/keys.mdanddocs/project-model.mdstate that.scdis added to a name with no extension, which is whatinstrumentProgramdoes.
…re shortened From the clean review of #183. Criterion 25 looked for the instrument's restart on the status line, which no longer carries it. The status line shortens the notes too once they alone are wider than the terminal, about twenty held keys at 80 columns, so the comment and docs say that instead of never.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 0m 48s
This pull request collects fixes from trying the keyboard instrument after #178 to #182. When field keys <name> names a program that is not on the project's shared/instruments/ shelf, the error lists the shelf by names that resolve, split by whether each program's text mentions FIELD_MODE. The status line ends with the sounding notes, and an instrument's state has its own line above it. examples/bloom gains two playable JU-06A instruments, juno and bass, and renames still-water-pad to pad. The keymap reload test saves again until each reload arrives. Since the clean review of 8b9718d, this head changes only prose, taking that review's two suggestions.
1 finding thread: 1 resolved, 0 open
Covered 13 of 13 changed files; no generated files. Since 8b9718d, three files changed: a comment in src/commands/keys.ts, one sentence in docs/keys.md, and criterion 25 in the keyboard-instrument plan. I read each against the code at cdcccaa. The other ten files are unchanged since the review of 8b9718d, and that reading stands.
- The new instruments were read, not rendered. This review does not start
sclangorscsynth, sojuno.scdandbass.scdstand on the earlier reading against the voice and render contracts and offset's sources. - The two-line drawing was read, not watched. This review does not open an interactive
field keys.
What I checked
All of this ran in a scratch worktree at cdcccaa, after pnpm install --frozen-lockfile.
- The new comment and doc sentence match
statusText. It returnsnotes.slice(0, width)only when the notes and the separator leave no room for the text before them. The slice shortens the notes only when they alone are longer than the width. So "the notes only when they alone are wider than it" holds. - Criterion 25 names the instrument's line. That matches
draw, which writes the instrument's state on its own line above the status line, and matches §2.1 step 6 and §2.4 of the plan. - No code changed. The only
.tschange since8b9718dis the comment abovestatusText. pnpm typecheck. Passes.pnpm exec vitest run src/commands/keys.test.ts src/keys/voice-host.test.ts src/keys/keymap.test.ts. 27 of 27 pass. The reload test is unchanged since8b9718d, where 32 runs of it, eight at a time, all passed.field keys organinexamples/bloom. Exits 1 and prints exactly the listingdocs/keys.mdshows.node ../../dist/cli.js checkinexamples/bloom, the step CI runs. Printsok.- The one finding thread. The dotted-name finding from
8447be4stays fixed at this head, because the listing code has not changed since8b9718dverified it. Its thread is resolved.
Trying the keyboard instrument after #178 to #182 merged turned up five things, and this pull request collects the fixes from that testing.
First,
field keys bassinexamples/bloomprinted only thatshared/instruments/bass.scddid not exist, which leaves you guessing at what the names are. A name that is not on the shelf now lists what is there, split into the instruments that play from notes and those that only render. The split reads each program's text forFIELD_MODE: a program that never reads it cannot answer voice mode, so its text is enough to tell, without startingsclangonce per program. Directories and files that are not.scdare left out. Outside a project, a bare name still fails as before, because there is no shelf to list.Second,
still-water-padwas the only instrument you could play.examples/bloomnow has two more,junoandbass, both the JU-06A from okamnesiac/offset (patches/ju06a.scd), a model of the Roland Juno's chain: DCO (saw, pulse, sub, noise), high-pass, resonant low-pass, VCA, and a BBD-style chorus under one ADSR.junois set to offset's classic Juno pad fromsessions/juno.scd, andbassto the bass that patch's factory makes, which is the bass synth we built there. Each answersFIELD_MODE=voicewith a SynthDef under the voice contract, at true pitch, and otherwise renders a short demo under the sc-render contract, so it also works as asupercollider:source:junoa held C minor ninth,bassoffset's line. Each program carries its own copy of the graph, because a program's bytes are the cache key for what it renders, and a shared file loaded at run time would not re-key the renders that used it.Third,
still-water-padis nowpad, sofield keys padreads likefield keys junoandfield keys bass. Its SynthDefs arepadKeyandpadVoice, and with seed 90210 and 10 s it renders the same bytesstill-water-pad.scddid on main. Thepad-sctrack, both READMEs, the docs, and the plan follow; the plan's verification rows keep the old name, because the runs used it.Fourth, playing moved the status line around: the notes sat in the middle, so everything after them shifted with every key. The notes are last now, and a narrow terminal shortens the text before them, never the notes. The
Playing … Esc or Ctrl-C quits.line is gone, and an instrument's state, such asjuno live at 48000 Hz on MacBook Pro Speakers, has the first line to itself, redrawn in place only when it changes.Fifth, the keymap reload test failed now and then under load. A watch just started can lose a directory event outright, not only see it late, so the test saves again every 500 ms until each reload arrives; a save of text already loaded reloads nothing, so a repeat never adds one. Sixteen concurrent runs of the file pass.
docs/keys.mdshows the new listing and names the three playable instruments.Testing
From the repository root of this branch, after
pnpm install, with SuperCollider installed:The typecheck passes, and the two test files pass 25 of 25. A program named like
pad.v2.scdlists under that whole name, whichfield keysresolves. Thekeys organcommand exits 1 and prints:junoorbassunder "renders only", or no list at all, would mean the change is wrong. Each render writes a 4-second stereo WAV; I measured the chord at a -5.5 dBFS peak and the line at -9.4 dBFS, and a second render with the same seed was byte-identical, in stereo and mono. A clipped or silent file would mean the program is wrong. The renders are left in/tmp.To play them, from
examples/bloomin Ghostty or iTerm2, runfield keys junoorfield keys bass, withfieldbuilt from this branch. I could not listen here. In voice mode I rendered a recorded take of two notes through each, throughfield buildof a record entry with that instrument: both sounded from the first note, peaked near -10.5 dBFS, and fell silent one release time after the last note-off (1.5 s forjuno, 0.15 s forbass), so every voice frees itself.The status line is covered by
src/commands/keys.test.ts. I also ranfield keysandfield keys junoin a pseudo-terminal that answers the keyboard protocol: the first drew only the status line, ending· C4 E4while two keys were held; the second drewjuno startingabove it, then rewrote that line in place tojuno live at 48000 Hz on MacBook Pro Speakers. In a real terminal, the start of the status line should stay still while you play; anything after the notes, or a second status line, would mean the drawing is wrong.I also ran the full suite with
FIELD_AUDIODpointed at a native build: 932 passed, 1 skipped (the no-MIDI-source case, which runs only without a MIDI service).📽️ Projector summary of cdcccaa: https://field.amnes.ac/reviews/183