Skip to content

Ship the tracker and fourths keymaps (keyboard-instrument.md chunk 3) - #181

Merged
ninjudd merged 2 commits into
keys/chunk-2from
keys/chunk-3
Oct 11, 2026
Merged

ninjudd merged 2 commits into
keys/chunk-2from
keys/chunk-3

Conversation

@ninjudd

@ninjudd ninjudd commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Musical Typing is the keymap most musicians know from a computer keyboard, but it reaches only 18 notes before you transpose. This chunk of the keyboard-instrument plan, stacked on #179, ships the two alternatives the plan chose as built-ins: tracker, the layout trackers have used from FastTracker 2 to Renoise, with two piano octaves on the bottom and top rows (32 notes), and fourths, an isomorphic grid with a semitone per key and a perfect fourth per row (27 notes), where a chord shape plays the same in every key.

Both are plain keymap files in the format #178 introduced, and both were already that chunk's schema fixtures, so the format was known to express them; the tests now read the shipped files instead. Each puts transpose and velocity on the arrows and sustain on Space, because their notes take the rows Musical Typing keeps for controls. docs/keys.md describes them, and the plan records the chunk as built in §11.

Testing

Run these from the repository root of this branch. field keys needs the daemon (pnpm build:native); --print does not.

pnpm install --frozen-lockfile
pnpm typecheck
pnpm test
pnpm field keys --keymap tracker --print
pnpm field keys --keymap fourths --print

pnpm test passes; when I ran it on this head, 904 tests passed with none skipped. The tracker diagram puts C3 under Z and C4 under both , and Q; the fourths diagram puts C3 under Z, F3 under A, A#3 under Q, and D#4 under 1. A diagram with notes elsewhere means a keymap file is wrong.

Then play them in Ghostty or iTerm2 with pnpm field keys --keymap tracker and, in a second terminal, native/audiod/build/field-audiod_artefacts/Release/field-audiod --midi-monitor "Field Keys". Pressing Z, Q, and I prints note-ons 48, 60, and 72, and → shows transpose +12 on the status line. With --keymap fourths, pressing Z B D together and then X N F together prints 48, 52, 55 and then 49, 53, 56. I ran both in a pseudo-terminal through the real helper and CoreMIDI, typing as this Mac's ColemakC keyboard layout does, and the monitor heard exactly those notes, each with one note-off. Real keys in a real terminal are still owed, as plan §9.3 says. The commands leave no state behind.

📽️ Projector summary of 07e7208: https://field.amnes.ac/reviews/181

@ninjudd
ninjudd added this pull request to stack #180 October 10, 2026 23:31
@ninjudd ninjudd changed the title Ship the tracker and fourths keymaps Ship the tracker and fourths keymaps (keyboard-instrument.md chunk 3) Oct 10, 2026

@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.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 5m 15s

This pull request ships the two other built-in keymaps the keyboard-instrument plan chose, tracker and fourths, as YAML files in keymaps/, so field keys --keymap tracker and --keymap fourths resolve by bare name. The files are the text that chunk 1's schema tests carried as inline fixtures. Those tests now read the shipped files, and a new test resolves and loads every built-in. docs/keys.md gains a section on both keymaps, and the plan records chunk 3 as built in §11. Criteria 28 and 29 ran in a pseudo-terminal through the real helper, and a run at a real keyboard is left for later.

0 finding threads: 0 resolved, 0 open

Covered 6 of 6 changed files; none are generated.

The full pnpm test suite was not run, because the scratch checkout has no native build for the daemon tests. The focused keymap, schema, and print tests ran instead. Criteria 28 and 29 were not run here, because they need a terminal session and a virtual MIDI source. The linux CI job was still pending when this review was published.

Suggestions

  • docs/projects/keyboard-instrument/readme.md:976: add a "still owed" line to §11 for criteria 28 and 29 at a real keyboard, as §9.3 and §10.4 do for their chunks. The pull request body says real keys are still owed "as plan §9.3 says", but §9.3 names only criteria 1 to 20, so the plan never records the debt for these two.
  • docs/projects/keyboard-instrument/readme.md:988: "where the tables above say" points at tables that §11 does not have, because §11 holds one table. Name the notes instead, such as C3 on KeyZ in both diagrams and C4 on KeyQ and Comma in tracker.

What was checked

  • Every tracker binding, by hand. The white keys Z X C V B N M , . / play offsets 0, 2, 4, 5, 7, 9, 11, 12, 14, and 16, and Q W E R T Y U I O P [ ] play 12 to 31. Black keys sit only where a piano has them, so F, K, 4, 8, and - are unbound. That is 37 positions and 32 distinct notes from C3 (48) to G5 (79), with KeyZ 48, KeyQ and Comma 60, and KeyI 72.
  • The fourths grid, by hand. Each offset is the key's column index plus 5 times its row index, over rows of 10, 11, 12, and 12 keys. That gives 27 distinct notes from 48 to 74, with KeyZ 48, KeyA 53, KeyQ 58, and Digit1 63. KeyZ KeyB KeyD play 48, 52, and 55, and KeyX KeyN KeyF play 49, 53, and 56, as criterion 29 expects.
  • Both diagrams. Both keymaps were rendered through loadKeymap and printKeymap, the two calls --print makes. They match the hand results and the pull request's Testing section, including the line that lists Space and the arrows.
  • The shipped files are the fixtures. Both files are byte-identical to the base's TRACKER and FOURTHS strings, as §11 says, and fourths.yaml matches the example in §2.4.
  • The tests read the shipped files. Changing tracker's KeyI from 24 to 23 fails the tracker test, with 31 distinct notes where 32 are expected.
  • Every reader of keymaps/. builtinKeymapNames() feeds only the unknown-name error and the tests. The error test's pattern still matches with three names.
  • The docs. The new section of docs/keys.md matches the files: C3 on Z in both keymaps, transpose ±12 and velocity ±20 on the arrows, and sustain held on Space. No other doc names musical-typing as the only built-in. In §11, the letters z b s, x k t, and u are KeyZ KeyB KeyD, KeyX KeyN KeyF, and KeyI under Colemak, so the criteria rows name the right positions.
  • Commands. pnpm typecheck exits 0. vitest run src/schema/keymap.test.ts src/keys/keymap.test.ts src/keys/print.test.ts passes 27 tests. project check reports the plans valid. The plan stays in-progress, so no readiness gate applies.

@ninjudd
ninjudd marked this pull request as ready for review October 10, 2026 23:39
ninjudd added a commit that referenced this pull request Oct 10, 2026
…ll owes

Review of #181 found that §11's diagram row pointed at tables the section does not have, and that §11 never recorded criteria 28 and 29 at a real keyboard as owed, as §9.3 and §10.4 do for theirs.

@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.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 0m 41s

This pull request ships the two other built-in keymaps the keyboard-instrument plan chose, tracker and fourths, as YAML files in keymaps/, so field keys --keymap tracker and --keymap fourths resolve by bare name. The files are the text that chunk 1's schema tests carried as inline fixtures. Those tests now read the shipped files, and a new test resolves and loads every built-in. docs/keys.md describes both keymaps, and the plan records chunk 3 as built in §11. Since the review of 57c18fb, one commit changes only §11: its diagram row names the notes the diagrams show, and a new line records criteria 28 and 29 at a real keyboard as still owed.

0 finding threads: 0 resolved, 0 open

Covered 6 of 6 changed files; none are generated.

The new commit changes only docs/projects/keyboard-instrument/readme.md. Every other file is byte-identical to 57c18fb, so the typecheck and the focused tests that ran there cover this head, and they were not run again. The full pnpm test suite was not run, because the scratch checkout has no native build for the daemon tests. Criteria 28 and 29 were not run here, because they need a terminal session and a virtual MIDI source.

What was checked

  • Both earlier suggestions are addressed. The diagram row in §11 no longer points at tables the section lacks. It names C3 under KeyZ in both diagrams, C4 under KeyQ and Comma in tracker, and F3, A#3, and D#4 under KeyA, KeyQ, and Digit1 in fourths. Those are MIDI 48, 60, 53, 58, and 63, which match the diagrams rendered at 57c18fb through loadKeymap and printKeymap, the calls --print makes. The new "Still owed" line records criteria 28 and 29 at a real keyboard in Ghostty and iTerm2, and it describes §9.3 correctly as covering criteria 1 to 20.
  • Every tracker binding, by hand. The white keys Z X C V B N M , . / play offsets 0, 2, 4, 5, 7, 9, 11, 12, 14, and 16, and Q W E R T Y U I O P [ ] play 12 to 31 on the white notes. Black keys sit only where a piano has them. That is 37 positions and 32 distinct notes from C3 (48) to G5 (79), with KeyZ 48, KeyQ and Comma 60, and KeyI 72.
  • The fourths grid, by hand. Each offset is the key's column index plus 5 times its row index, over rows of 10, 11, 12, and 12 keys. That gives 27 distinct notes from 48 to 74, with KeyZ 48, KeyA 53, KeyQ 58, and Digit1 63. KeyZ KeyB KeyD play 48, 52, and 55, and KeyX KeyN KeyF play 49, 53, and 56, as criterion 29 expects.
  • The shipped files are the fixtures. Both files are byte-identical to the base's TRACKER and FOURTHS strings, and changing tracker's KeyI from 24 to 23 fails the tracker test.
  • The docs. The new section of docs/keys.md matches the files, and no other doc names musical-typing as the only built-in.
  • Commands. At 57c18fb, whose code this head shares: pnpm typecheck exits 0, and vitest run src/schema/keymap.test.ts src/keys/keymap.test.ts src/keys/print.test.ts passes 27 tests. At this head, project check reports the plans valid. The plan stays in-progress, so no readiness gate applies.

@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.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 1m 03s

This pull request ships the two other built-in keymaps the keyboard-instrument plan chose, tracker and fourths, as YAML files in keymaps/, so field keys --keymap tracker and --keymap fourths resolve by bare name. The schema tests that carried both as inline fixtures now read the shipped files, docs/keys.md describes both keymaps, and the plan records chunk 3 as built in §11, including what is still owed. This head rebases the same two commits onto keys/chunk-2 after chunks 1 and 2 gained fixes. This pull request's own diff is unchanged, apart from one hunk header in docs/keys.md that moved from line 194 to line 197.

0 finding threads: 0 resolved, 0 open

Covered 6 of 6 changed files; none are generated.

The full pnpm test suite was not run, because the scratch checkout has no native build for the daemon tests. Criteria 28 and 29 were not run here, because they need a terminal session and a virtual MIDI source.

What was checked

  • This pull request's own diff is the one reviewed at a4a55a1. The diff from the new merge base to this head matches the diff from the old merge base to a4a55a1 line for line, apart from that one hunk header.
  • The base changes these keymaps depend on. The schema now checks named grid rows for a position given twice, and fourths names four rows that share no key, so it still validates. print.ts only exports signed(). The session change turns off toggled controllers at quit, panic, and reload, and neither keymap binds a toggle. The base's edits to docs/keys.md and the plan only spell out the monitor command's path, and they do not touch the sections this pull request adds.
  • Both diagrams, again. Both keymaps were rendered at this head through loadKeymap and printKeymap, the two calls --print makes. The output is identical to the earlier heads: tracker has 37 positions and 32 distinct notes from 48 to 79, and fourths has 27 distinct notes from 48 to 74. The notes §11 names under KeyZ, KeyQ, Comma, KeyA, and Digit1 match.
  • Commands at this head. pnpm typecheck exits 0. vitest run src/schema/keymap.test.ts src/keys/keymap.test.ts src/keys/print.test.ts src/keys/session.test.ts passes 49 tests. project check reports the plans valid. The plan stays in-progress, so no readiness gate applies.

@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.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 0m 55s

This pull request ships the two other built-in keymaps the keyboard-instrument plan chose, tracker and fourths, as YAML files in keymaps/, so field keys --keymap tracker and --keymap fourths resolve by bare name. The schema tests that carried both as inline fixtures now read the shipped files, docs/keys.md describes both keymaps, and the plan records chunk 3 as built in §11, including what is still owed. This head rebases the same two commits onto keys/chunk-2 after more fixes to chunks 1 and 2. This pull request's own diff is unchanged, apart from two hunk headers: one in docs/keys.md moved from line 197 to line 200, and one in the plan moved from line 972 to line 989.

0 finding threads: 0 resolved, 0 open

Covered 6 of 6 changed files; none are generated.

The full pnpm test suite was not run, because the scratch checkout has no native build for the daemon tests. Criteria 28 and 29 were not run here, because they need a terminal session and a virtual MIDI source.

What was checked

  • This pull request's own diff is the one reviewed at f2b7c2b. The diff from the new merge base to this head matches the diff from the old merge base to f2b7c2b line for line, apart from those two hunk headers.
  • The base changes since that review. They touch the voice host, src/commands/keys.ts, and the docs. None of them changes the keymap schema, the loader, the print code, the session, or keymaps/. The new docs/keys.md text resets a toggled controller on quit, panic, and reload, and both new keymaps hold sustain rather than toggle it, so their section still reads true. The plan's additions all fall in §10.2, so §11 still follows §10 and makes no claim that the additions affect.
  • Both diagrams, again. Both keymaps were rendered at this head through loadKeymap and printKeymap, the two calls --print makes. The output is byte-identical to the output at f2b7c2b: tracker has 37 positions and 32 distinct notes from 48 to 79, and fourths has 27 distinct notes from 48 to 74.
  • Commands at this head. pnpm typecheck exits 0. vitest run src/schema/keymap.test.ts src/keys/keymap.test.ts src/keys/print.test.ts src/keys/session.test.ts passes 49 tests. project check reports the plans valid. The plan stays in-progress, so no readiness gate applies.

keymaps/tracker.yaml plays the layout trackers use, two piano octaves on the bottom and top rows; keymaps/fourths.yaml is an isomorphic grid with a semitone per key and a perfect fourth per row. Both were chunk 1's schema fixtures, and the tests now read the shipped files. docs/keys.md describes them, and the plan records chunk 3 as built in §11, including criteria 28 and 29 played through CoreMIDI under a ColemakC layout.
…ll owes

Review of #181 found that §11's diagram row pointed at tables the section does not have, and that §11 never recorded criteria 28 and 29 at a real keyboard as owed, as §9.3 and §10.4 do for theirs.

@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.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 0m 32s

This pull request ships the two other built-in keymaps the keyboard-instrument plan chose, tracker and fourths, as YAML files in keymaps/, so field keys --keymap tracker and --keymap fourths resolve by bare name. The schema tests that carried both as inline fixtures now read the shipped files, docs/keys.md describes both keymaps, and the plan records chunk 3 as built in §11, including what is still owed. This head rebases the same two commits onto keys/chunk-2, whose only change since the last review is a rewrapped paragraph in docs/keys.md. This pull request's own diff is unchanged, hunk headers included.

0 finding threads: 0 resolved, 0 open

Covered 6 of 6 changed files; none are generated.

No TypeScript changed since the review of a972089. Every file outside docs/keys.md is byte-identical between the two heads, so the typecheck and the keymap and session tests that passed at a972089 cover this head, and they were not run again. The full pnpm test suite and criteria 28 and 29 were not run, for the reasons that review gave.

What was checked

  • This pull request's own diff is the one reviewed at a972089. The diff from the new merge base to this head matches the diff from the old merge base to a972089 line for line, hunk headers included.
  • The only base change since that review. One commit rewraps the paragraph in docs/keys.md that describes reloading a keymap, below the section this pull request adds. Between the two heads, nothing else differs: no other file in the base, and no line of this pull request.
  • Commands at this head. project check reports the plans valid, and the plan stays in-progress, so no readiness gate applies. At a972089, whose code this head shares: pnpm typecheck exited 0, and the schema, keymap, print, and session test files passed 49 tests.

@ninjudd
ninjudd merged commit 5dd16ed into main Oct 11, 2026
1 of 2 checks passed
@ninjudd
ninjudd deleted the keys/chunk-3 branch October 11, 2026 03:19
ninjudd added a commit that referenced this pull request Oct 11, 2026
…rd-instrument.md chunk 4) (#182)

`field keys` lets you play an instrument, but until now nothing you
played could be kept: the moment you found a part, it was gone. This
last chunk of the keyboard-instrument plan, stacked on #181, records it.
Give a track's record entry an instrument, run `field record` against
the song as you would for a vocal, and the take lands as the notes you
played. The build then renders those notes through the instrument, where
you played them in the song.

The design is the one the plan's §12 settled, building on the audio
recording already in Field rather than beside it. A MIDI take is a
transaction like an audio take, lands in the same `takes.yaml` with
`chosen`, is placed by the same arithmetic, and is picked with the same
`field choose`. It differs only where it must. The daemon arms for MIDI
instead of an input: it opens every MIDI source and stamps each message
on the audio callback's clock, so the take lines up with the song as an
audio take does. The take lands as a small text file of notes,
`audio/<track>/<take>.notes.yaml`, pinned in the song's ledger, and its
row carries `sources` where an audio row carries `device` and `input`.
Its latency is the output latency alone, because you play in time with
what you hear. The build mints a `voice-render` node for the chosen
take, which runs Field's own `sc/voice-render.scd`. That script plays
the instrument's voice from the notes with `sc/voicer.scd`, the same
voicing `field keys` plays live, so sustain and pitch bend sound as they
did while you played. The notes file, the instrument, and both scripts
key the cache, so editing the instrument re-renders every take recorded
for it.

The kinds stay apart. A take of the other kind than its entry records
will not land, and `field check` treats a mismatch or an instrument with
no program as an error. `field record` refuses `--input`, `--device`,
and `--loop` on a MIDI entry before it touches the daemon. The canonical
spelling is `instrument:` on its own line under `record:`, which is what
`field fmt` writes.

The daemon's half came from a parallel branch as three commits,
`c9ce60f`, `6341242`, and `9025aad`: arming for MIDI, the
`take.midi.ndjson` transaction with recovery, and the protocol with its
daemon tests and docs. `docs/keys.md` gains "Record what you play";
`tracks.md`, `project-model.md`, `build-graph.md`, `architecture.md`,
and `audio-engine.md` describe the entry, the take, the render node, and
the capture. The plan records the chunk as built in §13, with criteria
30 to 36. The criteria that need ears are still owed, so the plan stays
`in-progress`.

## Testing

From the repository root of this branch, with the native helper built
(`pnpm build:native`) and SuperCollider installed:

```sh
pnpm typecheck
FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm test
project check
```

You should see the typecheck pass, `929 passed | 1 skipped`, and
`Project plans are valid.` The skip is the no-MIDI-source refusal, which
runs only where there is no MIDI service. The tests that cover this
chunk:

- `src/commands/land.test.ts` (the MIDI cases): a take landed on a track
placed at bar 5 sits at sample 48000 with latency 128, the output's
alone, and the notes file, row, and ledger pin are exact.
- `src/generators/voice-render.test.ts`: the render's cache inputs, and
a real-`sclang` render that is the same bytes from a cold cache.
- `src/commands/record-midi-daemon.test.ts`: `field record` end to end
through the null output with a source the helper publishes.

A failure in the last one that reads `cannot create a virtual MIDI
source` after retries means CoreMIDI is refusing sources outright, not
the brief refusal plan §13.2 describes. If the Mac sleeps during the
suite, every test running at that moment times out together; run it
under `caffeinate -s -i`, as I did.

To try it by hand without sound, in a scratch project (`field init`,
`field song create creek`, copy
`examples/bloom/shared/instruments/still-water-pad.scd` into
`shared/instruments/`, then create a `played` track whose record entry
has `instrument: still-water-pad`):

1. Publish a source with
`native/audiod/build/field-audiod_artefacts/Release/field-audiod --keys
"Field Keys Verify"`, or run `field keys still-water-pad`, which plays
aloud.
2. In another terminal, from the scratch project, run
`FIELD_AUDIOD_NULL=1 field record creek/track:played --at 1.2.1`. Send a
few notes (in `field keys`, type them), then press Ctrl-C.
3. Run `field record --list`, then `field build creek`.

I ran exactly this with a script sending two notes. Expect `armed MIDI
from Field Keys Verify`, then `recording take-… from 1.2.1 (0:00.5)`,
then `take creek/played ← take-… at bar 1.2, chosen
(audio/played/take-….notes.yaml, 2.3 s, 4 events)`. The notes file holds
one row per note, timed to within 5 ms of when they were sent. `field
build creek` builds `//songs/creek/gen:played` and the track over it. A
take with no `.notes.yaml`, or `gen:played` missing from the build,
means the MIDI path did not run. The run leaves the scratch project with
the take, its ledger row, and `.field/out/` renders; nothing outside it
changes. Criteria 30, 31, 35, and 36 still need a real output device and
ears: record with `field keys still-water-pad` playing, then `field play
creek`.

<!-- projector-summary v=1 sha=98ca869ecd1af6dbdf8de990df6c2d9961972c74
-->
📽️ **Projector summary** of 98ca869: https://field.amnes.ac/reviews/182
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