Skip to content

Plan instrument knobs: choose with the arrows, turn with up and down, and record every turn - #202

Merged
ninjudd merged 5 commits into
mainfrom
spec/instrument-knobs
Oct 11, 2026
Merged

ninjudd merged 5 commits into
mainfrom
spec/instrument-knobs

Conversation

@ninjudd

@ninjudd ninjudd commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

field keys lets you change one thing about an instrument while you play: the modulation wheel, in six fixed steps on keys 3 to 8. Everything else is baked into the instrument as constants when its program loads, so to hear juno with a darker filter you edit juno.scd and save. Justin asked on 2026-10-11 for a different way: the arrows move between knobs, up and down turn the chosen one, holding turns faster, and each instrument lists its knobs by name so field keys can show them. This pull request adds that plan, docs/projects/instrument-knobs/readme.md, as ready with priority next. It changes no code.

Justin reviewed the first version here and reshaped it. Its largest change is that the knobs belong to field keys as a MIDI controller, the way a hardware controller has knobs:

  • Only MIDI leaves field keys. Choosing, turning, typing, gliding, keeping each knob's value, and the knob line all live in field keys. What leaves it is a control change on Field Keys. So the knobs drive Logic, a hardware synth, or an AU instrument exactly as they drive juno, a hardware controller's knobs turn juno too, and a take records every change because the daemon already captures MIDI.
  • One knob file format for every instrument, checked only by Field. A small YAML file names each knob, the controller (CC) that turns it, and its range, curve (lin or exp), step, units, and default. The instrument sets the range. A SuperCollider instrument keeps its knob file beside its program, and any other instrument gets one named with --knobs. One TypeScript schema checks every file on every path that hands one to an instrument: before the voice host starts, before each reload on save, and in the take render's validate, which field check already runs for every record entry's instrument, so the check and the build report the same errors. A file that fails never reaches SuperCollider.
  • No knob logic in SuperCollider. The voicer hands every controller to its voices as a control named for its number, cc74, from 0 to 1, as it already hands the wheel over as mod. Each voice maps its own controls. juno reads its ranges from FIELD_KNOBS, a copy of its knob file that Field wrote after the file passed the check, so each range is written once.
  • musical replaces musical-typing as the default. It is Field's adaptation of Logic's Musical Typing, with every note where Musical Typing puts it. The arrows choose and turn, the number row types a knob's value, the bend moves to , and ., whose keys show < and >, and the wheel becomes the knob mod. Holding a turn key speeds up from one step to four every 40 ms.
  • Typing a value. Digits and - open an entry in the knob's own units, and . types the decimal point while an entry is open and bends up otherwise; Enter completes it, clamped to the range and landed on the nearest of the controller's 128 steps. It then glides there at the keymap's glide speed, in seconds per full range: 0 jumps, and musical uses 1. Esc cancels an entry and no longer quits field keys; Ctrl-C quits. That amends keyboard-instrument.md's rule that Esc always quits, and the plan lists every place that says it does.
  • A take starts where your knobs were. field keys publishes the controllers it has sent, field record passes them in arm, and the daemon chases controllers from the arm and writes them at the take's first sample.

The plan marks Justin's decisions DECIDED, 2026-10-11, Justin. It marks the calls they needed for Justin's review: the knob file and how field keys finds it, musical replacing musical-typing, . as the decimal point only during an entry now that it bends otherwise, glide's unit and defaults, typing in the knob file's units, clamping, and the names tracked and quartal proposed for tracker and fourths. One of those calls is still open for him: whether a SuperCollider voice reads the checked copy of its knob file, with each range written once, or writes its own mapping, with each range written twice and free to drift. §3.2 sets out both. The first heading drops its Plan: prefix, as main now does for every plan.

The review loop's findings are all fixed and resolved:

  • The first round's two. The open questions on the Electron UI and on tracker and fourths are deliberate deferrals that block no chunk, so ready stays honest. A lin knob prints fixed decimal places, so res keeps the width that criterion 1 shows.
  • The second round's one. A voice read its knob file without Field's check, so a rejected file still shaped the sound. Every path now checks the file first and hands SuperCollider only checked text, with no validation in SuperCollider.
  • Suggestions taken. An exp range may not touch zero; a default may sit at the end of its range; chased controllers come in arrival order; type takes a number from 0 to 9 as YAML reads it; an entry is padded in the walkthrough as the display rule pads it; the take-start criterion turns a knob, so chunk 3 needs only chunk 1; field check shares the render's knob check rather than adding its own; and docs/keys.md names FIELD_KNOBS for instrument authors.

The rollout is three chunks: knobs, typing with the glide, and where a take starts.

Testing

I ran these at fd53df5, from the root of the spec/instrument-knobs branch in my worktree at .claude/worktrees/agent-ac392ad6264f60e8b, with the Projector CLI and jq installed and nothing built:

project check
project show instrument-knobs | head -6
project list --json | jq '.projects[] | select(.name == "instrument-knobs")'
git diff --check origin/main...HEAD

project check prints Project plans are valid. and exits 0. It also prints one warning, that .github/workflows/projector-site.yml is an earlier shape; that file is not in this change. project show instrument-knobs prints the frontmatter status: ready and priority: next, then # Instrument knobs. project list --json piped through jq prints the project with "title": "Instrument knobs", "status": "ready", and "priority": "next". git diff --check prints nothing. An error from project check, a title that still starts with Plan: , or any output from git diff --check would mean the plan is malformed. None of the commands changes anything on disk.

There is no code to exercise yet. The numbers the plan quotes come from its own formulas, which I checked with Node. 800 on cutoff lands on controller value 62, which maps to 810 Hz. 300 lands on 301 Hz. A one-second glide from 127 to 62 takes 13 ticks. Every res value prints at five characters. I also ran sclang 3.14.1 on a sample knob file: String.parseYAMLFile reads it, returns its numbers as strings, and ControlSpec(50, 15000, \exp).map(62 / 127) gives 809.6. sc/voice-load.scd sets thisProcess.nowExecutingPath for each program, which is the precedent §2.4 cites for setting FIELD_KNOBS the same way. Each section of keyboard-instrument.md and arming.md that the plan cites says what the plan says it does. §4 lists the criteria and the vitest tests each chunk must pass.

📽️ Projector summary of fd53df5: https://field.amnes.ac/reviews/202

… and record every turn

field keys can change one thing about a sound while you play: the
modulation wheel, in six fixed steps on keys 3 to 8. Everything else
an instrument does is baked into its SynthDef when the program loads,
so changing a filter means editing the file and saving. Justin asked on
2026-10-11 for arrows that move between knobs and up and down that turn
them, faster while held, with instruments listing their knobs by name.

The plan has an instrument declare knobs in its voice: SynthDef
controls with a ControlSpec, listed in the SynthDef's metadata with the
MIDI controller that turns each. A turn is a control change through
Field Keys, so the voicer, MIDI capture, and the take's render all
handle it with code that exists. field keys times a held key itself,
draws every knob on a line of its own so the notes never move, and a
daemon chase seeded from field keys makes a take start where the knobs
were.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 10m 37s

This pull request adds the instrument-knobs plan at status: ready, priority: next. An instrument declares knobs as SynthDef controls with a ControlSpec and a MIDI controller number. field keys shows them on a line of their own, and Musical Typing's arrows choose and turn them, faster the longer you hold. The voicer sets them on sounding voices live and in a take's render, and chunk 2 starts each take at the knob positions field keys last sent. It changes no code. The Electron UI, tracker and fourths, finer steps, and saving a sound stay out of scope.

2 finding threads: 0 resolved, 2 open

Covered 1 of 1 changed files; none generated.

The plan changes no code, so no gate or tests ran. I ran project check at the head, which passes. Its one warning is about the site workflow, which this change does not touch. I computed criterion 1's knob line and the hold timing from the plan's own formulas with a short script.

Readiness gate. The status is ready, so every question the plan introduces must be answered or deferred. Questions 3 (finer than 128 steps) and 4 (keeping a sound) defer their work out of the plan explicitly, and do not block. Questions 1 (the Electron UI) and 2 (tracker and fourths) wait on Justin's decision, and block. One thread covers both.

Suggestions

  • docs/projects/instrument-knobs/readme.md:133. Add a load rule that an \exp knob's min and max are non-zero with the same sign, as SuperCollider's ExponentialWarp requires. ControlSpec(0, 1, \exp) maps every controller value above 0 to nan, in the voice and on the knob line.
  • docs/projects/instrument-knobs/readme.md:140. Say that "inside the range" includes its ends. bass's attack default, 0.005, equals the minimum of the ControlSpec(0.005, 4, \exp) it shares with juno, so a strict check fails bass at load.
  • docs/projects/instrument-knobs/readme.md:290. The chase keeps one value per channel, but the voicer keeps one value per controller for every channel (§2.4, keyboard-instrument.md §14.2). When two channels send the same controller before a take, the rows at at: 0 replay in table order rather than arrival order, and the render can start on a value the voice did not last play. Write the chased rows in arrival order.
  • docs/projects/instrument-knobs/readme.md:6. #200 drops the Plan: prefix from every plan's heading, and this plan is not in its file list. Whichever of the two lands second should make this heading # Instrument knobs.

Checked against main

  • Keymaps. Musical Typing leaves the arrows free. tracker and fourths bind them to transpose and velocity, which the plan leaves alone and criterion 9 checks. The tags K±1 and R±1 do not collide with T, V, B, cc, or !! in src/keys/print.ts, and a keymap has the channel a turn sends on.
  • Voice host and voicer. The voice contract (freq, amp, gate, out, optional mod) matches keyboard-instrument.md §2.6 and §14. The host loads every program before it boots scsynth, so knob lines can precede the server. emit writes flat JSON. voice-load.scd and the voicer are shared by the host and voice-render.scd. start takes four arguments today, and a voice is a list of synths, one per instrument (arming.md §9).
  • Instruments. juno.scd's settings Event has 26 entries. The defaults, 2000, 0.3, 0.8, and 1.5 for juno and 1200, 0.4, 0.005, and 0.15 for bass, fall inside the proposed specs. All four settings reach the graph as signals, through cutoff, clip, and Env.adsr, never through an if.
  • SuperCollider 3.14.1. Symbol.kr(val, lag, fixedLag, spec) passes the spec to NamedControl, which stores it under metadata[\specs]. ControlSpec.map warps and then rounds to step, as §2.2 and §8 say.
  • Status line (#195) and reload (#188). The status line shows mod unpadded when setsMod() holds or mod is non-zero. A failed reload reads <name> kept its last voice:, which criterion 7 relies on.
  • Takes (#182, #191). A controls row already carries cc, value, and an optional channel, so a knob turn needs no new event kind. renderEvents puts control changes before note-ons at one instant. The daemon discards MIDI before the start, stampMidiBlock drops at below 0, hello carries features, and arm has the tracks form.
  • Hold timing. One step at the press and then 18, 24, and 84 steps through §2.6's bands reach 127 at 2.30 s, at no more than 25 sends a second, as criteria 2 and 4 expect.
  • Citations and paths. Every section the plan cites exists and says what it is cited for: keyboard-instrument.md §2.2, §2.4, §2.6, §3, §5, §14, and §14.5, and arming.md §3, §9, and chunk 3. Every existing path in §2.8 and §4 exists. src/keys/knobs.ts and its test are new. Every flag the criteria use exists, including --midi-monitor, --count-in, and field sc render --seed.
  • Neighbors. #201 changes the host's start callback, src/commands/keys.ts, and src/keys/voice-host.ts. #198 changes player.cpp, server.cpp, protocol.ts, and client.ts. Both overlap §2.8 only in text: #201 gives each instrument's synths their own out bus and leaves the voice's SynthDef and controls alone. Automation's question 5, the tempo map in the daemon, is untouched, because the chase writes only at sample 0.
  • Conventions. The plan opens with # Plan: and a **Goal:** line as every plan on main does. Its decisions keep their rejected alternatives under a (DECIDED, …, for Justin's review) heading, as arming.md's do. Its prose wraps at 72 columns.

ninjudd added a commit that referenced this pull request Oct 11, 2026
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.
…s as plain MIDI, musical types values, and Esc cancels

Justin reviewed the plan in #202 and reshaped it. The knobs now belong
to field keys as a MIDI controller: choosing, turning, typing, gliding,
and the knob line live there, and only control changes leave it, so
the knobs drive Logic or a hardware synth as they drive juno. Every
instrument describes its knobs in one YAML knob file, and Field reads
it in TypeScript. SuperCollider keeps no knob logic: the voicer hands
each controller to its voices as cc<n>, as it already hands the wheel
over as mod, and each voice maps its own controls.

musical, Field's adaptation of Musical Typing, replaces musical-typing
as the default. The arrows choose and turn, the number row types a
value that glides at the keymap's glide speed, and the bend moves to B
and N. Enter completes an entry, Esc cancels it and no longer quits,
and Ctrl-C quits. The first heading drops its "Plan: " prefix.

The review loop's two findings are fixed. Both open questions are now
deliberate deferrals that block no chunk, so the plan stays ready. A
lin knob prints fixed decimal places, so res keeps the width that
criterion 1 shows. Three of its suggestions are taken: an exp range
may not touch zero, a default may sit at the end of its range, and
chased controllers are written in arrival order.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 6m 17s

This head rewrites the instrument-knobs plan after Justin's review. The knobs now belong to field keys as a MIDI controller. A YAML knob file beside each instrument, or one named with --knobs, describes them, and field keys checks and shows them. Every change leaves as a control change, which the voicer hands to SuperCollider voices as cc<n>, from 0 to 1, for each voice to map itself. musical replaces musical-typing as the default keymap: the arrows choose and turn, the number row types a value that glides, and the bend moves to B and N. Esc cancels an entry and no longer quits. The take's starting positions become chunk 3. The plan stays at status: ready, priority: next, and changes no code.

3 finding threads: 2 resolved, 1 open

Covered 1 of 1 changed files; none generated.

The plan changes no code, so no gate or tests ran. I ran project check at the head, which passes with only the site-workflow warning that this change does not touch. I computed the knob line, typed values, and glides from the plan's formulas with a short script. I also ran a scratch sclang program outside the repository to check the §2.4 helper and parseYAMLFile.

Earlier findings. Both are fixed at this head, and their threads are resolved. §7 now defers all four questions out of the plan, each with what reopens it. §2.5 gives a lin knob fixed decimal places, so res prints 0.000 to 0.950 at five characters, and criterion 1's line matches the rule. The heading drops its Plan: prefix, as main has since #200. Three suggestions are taken: an exp range may not touch zero, a default may sit at an end of its range, and chased rows come in arrival order.

Readiness gate. The status is ready. Every question in §7 is deferred out of the plan, and §3.1 and §3.2 record the new decisions with the alternatives they beat, so no question blocks. The one new finding is a defect in the design, not an open question.

Suggestions

  • docs/projects/instrument-knobs/readme.md:221. YAML reads type: 1 as the number 1 and type: "." as a string, so a schema that takes type as a one-character string rejects musical's own number row. Say that type takes an integer from 0 to 9 or the string "." or "-", or quote the digits.
  • docs/projects/instrument-knobs/readme.md:99. §2.1 step 6 shows cutoff 800_ Hz, but §2.5 pads an entry to the value's width, eight characters for cutoff, which gives cutoff 800_ Hz, as §2.5 shows.
  • docs/projects/instrument-knobs/readme.md:762. Chunk 3 says it needs chunk 1, but criterion 20 types a low cutoff, which needs chunk 2. Turn cutoff down there instead, or name chunk 2 as a prerequisite.

Checked against main

  • The rename. Every reference to musical-typing outside the plans is in a file §2.9 lists or a test §4 names: docs/keys.md, bass.scd's comment, src/cli.ts, DEFAULT_KEYMAP, and five test files. The unknown-name error already lists the built-ins, as criterion 10 expects. §8's free keys match musical-typing.yaml, whose notes sit on the home row and W E T Y U O P.
  • Quitting and keys. Today isQuit quits on Esc and Ctrl-C, the keymap schema reserves Escape because "it always quits", and positionOf names only Tab and Space among functional keys, as §8 says. Period and Minus are positions already. keyboard-instrument.md §2.4 holds the Escape rule this plan amends, and §3 holds the Musical Typing choice with the reasons §3.2 quotes.
  • SuperCollider 3.14.1. parseYAMLFile returns numbers as strings. The §2.4 helper builds cc74 and cc71 controls at the unmapped defaults, 0.647 and 0.316, and maps them inside the graph. ControlSpec(50, 15000, \exp).map(62 / 127) is 809.6.
  • Numbers. Typed 800 lands on 62 (810 Hz), 300 on 40 (301 Hz), 99999 on 127, and 20 on 0. At glide: 1, 127 to 62 takes 13 ticks, 520 ms. The hold still reaches the top in 2.30 s, and an entry on cutoff reads cutoff 800_ Hz.
  • Takes. src/generators/voice-render.ts runs the program from its project path, so a voice finds its knob file beside it. renderEvents still puts control changes before note-ons at one instant.
  • Neighbors. #196, #198, and #201 are still open, and they overlap §2.9 only in text, as before.

…ly a knob file Field checked

The review found that only field keys ran the knob schema, while a
SuperCollider voice read its knob file directly on every load, a
reload on save, and a take's render. So a file the schema rejected
still shaped the sound: a knob moved to CC 1 went silent, and an exp
range from 0 rendered a nan cutoff.

Field now checks every knob file on every path that hands it to an
instrument, and SuperCollider reads only a copy of text that passed.
field keys checks before the voice host starts and on each save, and
writes the copy the voice reads before a reload; a save that fails
reloads nothing, so the last good voice plays on. voice-load.scd hands
each program its copy as FIELD_KNOBS, as it already hands over the
program's own path. A take's render checks the file, fails with the
schema's errors before sclang runs, and refuses to cache if the file
changes while it renders. field check reports a bad file first. No
validation moves into SuperCollider.

Section 3.2 now gives Justin the choice he has not made: a voice that
reads the checked copy, with each range written once, or a program
that writes its own mapping, with each range written twice and free to
drift. Three suggestions are taken: type takes a number from 0 to 9 as
YAML reads it, step 6's entry is padded as section 2.5 pads it, and
criterion 20 turns the knob, so chunk 3 needs only chunk 1.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · took 2m 39s

This head answers the second review. Field now checks a knob file on every path that hands it to an instrument, and a SuperCollider voice reads only a copy that passed. field keys checks each instrument's knob file before the voice host starts and on each save. It writes the copy a voice reads, named by FIELD_KNOBS, only when a save passes, and reloads nothing after a save that fails, so the last good voice plays on. A take's render checks the file and fails with the schema's errors before sclang runs, and field check reports a bad file first. §3.2 records the checked copy as the recommended call, with its alternative, for Justin to rule on. Three earlier suggestions are taken. The plan stays at status: ready, priority: next, and changes no code.

3 finding threads: 3 resolved, 0 open

Covered 1 of 1 changed files; none generated.

The plan changes no code, so no gate or tests ran. I ran project check at the head, which passes with only the site-workflow warning that this change does not touch. I ran no SuperCollider this round, because the change moves only where the voice finds its knob file, and the previous round checked parseYAMLFile and the mapping helper.

Earlier findings. The finding on line 148 is fixed at this head, and its thread is resolved. No path that hands a knob file to an instrument skips the schema now, and criteria 11 and 22 check the live path and the build path. The two first-round findings stay fixed: §7, §2.5, and criterion 1 are unchanged since the previous head.

Readiness gate. The status is ready. §7's four questions stay deferred out of the plan. The new call in §3.2, that a voice reads the checked copy, says Justin has not ruled on it. The plan answers it all the same: §2.4, §2.9, the criteria, and the tests specify the copy, and §3.2 records the alternative and the recommendation under the same for-review heading as every other call there. It is a decision awaiting review, not an open question, so it does not block.

Suggestions

  • docs/projects/instrument-knobs/readme.md:496. field check already validates a record entry's instrument by calling the voice render's own validate in src/generators/voice-render.ts, so that check and the build resolve the program by one rule. Put the knob file's check there too, rather than in src/model/project.ts, and the two share it the same way.
  • docs/projects/instrument-knobs/readme.md:500. The docs/keys.md row adds the cc<n> controls to "Make an instrument playable" but not FIELD_KNOBS, which an instrument's author needs there to read the checked copy. The docs/build-graph.md row names it.
  • docs/projects/instrument-knobs/readme.md:81. Rewrap two paragraphs this head edited, which break early at "It loads" on line 81 and "knob that" on line 310, while the rest of the plan wraps at 72 columns.

Checked against main

  • Every path to an instrument. At start, field keys checks before the voice host starts (§2.1 step 1, §2.2). On a save, it checks, rewrites the copy only when the save passes, and reloads nothing otherwise (step 7, §2.2, criterion 11). A program saved while its knob file fails loads with the last good copy (§2.4). A take's render checks the file and passes its own checked copy (§2.4, the voice-render.ts row, criterion 22). field check reports a bad file (§2.2, the project.ts row). juno's snippet reads FIELD_KNOBS, so no voice reads the original file.
  • Existing code. verifyAfterRun exists on the voice render and already refuses to cache a render whose program changed while it ran. voice-load.scd already sets each program's own path, as nowExecutingPath, which is the precedent §2.4 names. FIELD_INSTRUMENTS is a JSON list of paths today, which the voice-host.ts row extends.
  • Earlier suggestions. type takes a number from 0 to 9 as YAML reads it, in both the table and the keymap test. Step 6's entry is padded as §2.5 pads it. Criterion 20 turns cutoff down, so chunk 3 needs only chunk 1. The rollout assigns each of the 22 criteria to a chunk.

@ninjudd
ninjudd marked this pull request as ready for review October 11, 2026 17:23
… shares the render's knob check

field check already validates a record entry's instrument through the
voice render's own validate, so the check and the build resolve the
program by one rule. The knob file's check now lives in that validate
too, in place of a separate check in src/model/project.ts, so field
check and the build report a bad knob file with the same errors.

The docs/keys.md row now names FIELD_KNOBS under "Make an instrument
playable", where an instrument author needs it to read the checked
copy. Two paragraphs the last revision edited are rewrapped to the
plan's 72 columns.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · incremental from 05e75dd · took 1m 03s

Incremental review of the change since the full review of 05e75dd: +17 −17 lines in 1 file.

This push takes the clean review's three suggestions. The knob check moves into the voice render's validate, and that holds: loadProject runs it for every record entry's instrument, and field build refuses a project with errors before it renders, so a bad knob file stops the render before sclang runs and field check reports the same error. The docs/keys.md row names FIELD_KNOBS, and two paragraphs are rewrapped. §3.2's call awaiting Justin is unchanged, so the readiness gate stands.

… point on . only during an entry

Justin asked for the pitch bend in the musical keymap to sit on , and
., whose keys show < and >: down on Comma and up on Period, held as
before, in place of B and N. Musical Typing binds neither key, and
neither is an arrow or a typing key.

Period was also the plan's decimal point. It now types the decimal
point only while an entry is open, in every keymap, as Enter and
Backspace act only on an entry, and does its keymap action otherwise.
So type no longer takes ".", a value starts with 0 rather than ., and
the bend up waits while an entry is open. Section 3.2 records that as a
call for Justin's review, with the alternatives it beat: a decimal
point on a key that prints no ., and an entry-only second action for
any key. Criterion 9 now bends on . and ,, and new criterion 23 types
0.8 with . and then bends with it.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · took 2m 13s

Since the last full review, at 05e75dd, the plan takes that review's three suggestions and makes one call of Justin's. The knob check moves into the voice render's validate, the docs/keys.md row names FIELD_KNOBS, and two paragraphs are rewrapped. In musical, the pitch bend moves from B and N to , and ., the keys that show < and >. Because Period was also the decimal point, it now types . only while an entry is open, in every keymap, and does its keymap action otherwise. So type no longer takes ".", and a value starts with 0, not .. Criterion 9 bends on the new keys, and new criterion 23 types 0.8 with . and then bends with it. The plan stays at status: ready, priority: next, and changes no code.

3 finding threads: 3 resolved, 0 open

Covered 1 of 1 changed files; none generated.

The plan changes no code, so no gate or tests ran. I ran project check at the head, which passes with only the site-workflow warning that this change does not touch. I computed criterion 23's value with a short script and ran no SuperCollider.

Earlier findings. All three stay fixed at this head, and their threads are resolved. §7's deferrals, §2.5's width rule, and the knob file's checks on every path to an instrument are unchanged, apart from the validate placement the last review suggested.

Readiness gate. The status is ready. §7's four questions stay deferred out of the plan. §3.2 still records the checked copy as a call Justin has not ruled on, with the plan fully specifying it, as in the last full review. The new call, that Period types the decimal point only during an entry, is recorded in §3.2 with the two alternatives it beat. Neither is an open question, so neither blocks.

Checked against main

  • The new keys. Comma and Period are positions src/keys/position.ts already knows, and musical-typing.yaml binds neither, so the bend takes no note from musical. tracker plays notes on both keys, but it binds no type action, so no entry can open there, and . stays a note in tracker and fourths.
  • One key, two meanings. KeysSession.release acts on heldControls, which records what each press did. So a Period press that began a bend ends it on release, as §2.7 requires, and a press that typed . releases nothing.
  • Criterion 23. 0.8 on attack, ControlSpec(0.005, 4, \exp), lands on controller value 96, which prints 782 ms, as the criterion says.
  • The validate claim. loadProject runs the voice render's validate for every record entry's instrument, and field build refuses a project with errors before it renders. So a knob file that fails stops the render before sclang runs, and field check reports the same error.
  • main since the merge base. #185 adds field upgrade to src/cli.ts and changes the install hint in docs/keys.md and src/keys/helper.ts. #197 fixes tests in src/keys/voice-host.test.ts for Windows, and #200 drops heading prefixes. None of the plan's claims about existing code moves.
  • Consistency. §2.3, §2.7, §3.1, §3.2, criteria 9 and 23, the keymap and session tests, and the rollout all say the same thing about , and .. Criterion 23 is in chunk 2 with the rest of typing. No new line breaks the plan's 72-column wrap.

@ninjudd
ninjudd merged commit d94b734 into main Oct 11, 2026
2 checks passed
@ninjudd
ninjudd deleted the spec/instrument-knobs branch October 11, 2026 18:14
ninjudd added a commit that referenced this pull request Oct 11, 2026
… 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]>
ninjudd added a commit that referenced this pull request Oct 11, 2026
…eld keys on Ctrl-C alone (instrument-knobs.md chunk 2) (#210)

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
`musical` the number row types the chosen knob's value, in the units its
knob file names, so `800` on `cutoff` means 800 Hz and `0.8` on `attack`
means 800 ms. `Enter` completes it, and the knob glides to the
controller value nearest the number, since a controller carries only 128
values: `800` lands on `810 Hz`.

The glide is a run of control changes, one every 40 ms at most, at a
speed the keymap's new `glide` field sets: the seconds a value takes to
cross a knob's whole range. `musical` sets one second, and a keymap that
never mentions `glide` sets 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, so `Period` types 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 `.`. `Backspace` edits 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.

`Esc` now cancels a value instead of quitting, and with no value open it
puts `Ctrl-C quits` on the status line. `Ctrl-C` alone quits, and no
keymap can bind `Esc` or a `Ctrl` chord, 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`, and `Escape` are
positions the session handles before the keymap, from the kitty
protocol's `CSI 13 u`, `CSI 127 u`, and `CSI 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`).

1. `pnpm typecheck` prints nothing and exits 0.
2. `pnpm vitest run` reports 90 test files, 1191 tests passed and 1
skipped. A failure in `src/keys/session.test.ts`'s "typing a knob's
value" tests, `src/commands/keys.test.ts`'s "typing on the knob line",
or `src/keys/terminal.test.ts`'s quitting tests points at this change.
3. From `examples/bloom`, `node ../../dist/cli.js keys --print` draws
`musical` with `1` to `0` and `-` on the number row and lists each as
`type <c> into the chosen knob's value`.

I also drove `field keys --knobs` in a pseudo-terminal, sending the
kitty protocol's bytes, against a stand-in for `field-audiod --keys`
that logs every message it is sent and publishes no MIDI source. The
knob file had `juno`'s `cutoff` and `attack`. What it showed:

- `800` read `cutoff 800_ Hz`, and `Enter` glided CC 74 from 82 down to
62, five values a tick, to `810 Hz` (criterion 4).
- `12`, `Backspace`, `5` read `15_ Hz`. The first `Esc` closed it and
left `810 Hz`, the second put `Ctrl-C quits` on the status line, and
`Ctrl-C` quit with All Notes Off (criterion 6).
- `300` and `ArrowRight` glided to `301 Hz` and moved the choice
(criterion 7).
- `0`, `.`, `8` read `0.8_ s` and landed `attack` on `782 ms`, and `.`
with the value closed sent a bend up and its release (criterion 23).
- At most 5 control changes went out in any second.

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; point `FIELD_AUDIOD` at 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/bloom` in
Ghostty or iTerm2, run `node ../../dist/cli.js keys juno`, hold a chord,
choose `cutoff`, type `800`, and press `Enter`. The filter should close
over about half a second while the line runs down to `810 Hz`. A line
that jumps straight there means `glide` did not load from `musical`, and
a chord that stops when you type means the number row is still playing
notes.

<!-- projector-summary v=1 sha=cd79e60cbb9caef6c52bf077bbfebd65fb3579da
-->
📽️ **Projector summary** of cd79e60: https://field.amnes.ac/reviews/210

---------

Co-authored-by: Claude <[email protected]>
ninjudd added a commit that referenced this pull request Oct 11, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant