Skip to content

midi: a track can listen to one MIDI channel - #48

Open
mparrett wants to merge 2 commits into
nooga:masterfrom
mparrett:midi-channel-routing
Open

mparrett wants to merge 2 commits into
nooga:masterfrom
mparrett:midi-channel-routing

Conversation

@mparrett

@mparrett mparrett commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

A track can now listen to one MIDI channel. Right-click its R → MIDI in → When selected (the default, today's behaviour) or Channel 1–16.

  • A note on channel N plays every track set to N, selected or not. Channels no track claims fall through to the selected track, so existing projects play as before.
  • With MIDI REC on, each claimed channel records into its own track: the note clip under the playhead, or a new take clip. The pass is still one undo step, and the selection doesn't move.
  • Saved per track as "midi": N (docs/19). MIDI-learn and the knob map are unchanged.

The use case is a multitimbral source, such as a generator sending drone, pad, lead and drums on separate channels, played into several tracks at once.

Engine change. The engine held live notes for one track at a time, so a note for a second track released the first. Held keys now live on each track (Track.keys_held). When stopped with keys held on several tracks, audition renders the whole graph, as it already does for a track feeding a bus.

Behaviour change. The sustain pedal (CC64) and all-notes-off (CC120/123) now act on their own channel, per the MIDI spec. Before, a pedal on channel 1 also held channel-10 notes.

Demo. A generator sent drone (ch 1), pad (ch 3), lead (ch 4) and drums (ch 10) live into a project with one track per channel, REC on, for about 40 seconds. Each channel recorded its own take clip in the same pass. The channels no track claims went to the selected track's own take. The audio is that project rendered headless (--render):

undertone_channels.mp4

Testing. zig build test passes, with new tests for per-channel state, routing, project round-trip, multi-track engine holds, moving, deleting or inserting a track under held notes (every path that renumbers tracks remaps held keys through tracksRenumbered), and a release tail after keys held past the 30 s ring limit. The headless bench (--all --check --no-sheets) is bit-exact on every golden; it exits 1 on unmodified master too, with identical output.

🤖 Generated with Claude Code

Notes on a channel play every track set to it, selected or not, and
REC records them into each track's own clip in one undo step. Channels
no track claims go to the selected track as before, so the default
changes nothing for existing projects. The setting is in the R button's
right-click menu and saves as the track's `midi` (docs/19).

The engine's held keys are now per track: several tracks can hold notes
at once, and stopped, they ring out through the whole graph. The
sustain pedal and all-notes-off act on their own channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mparrett
mparrett marked this pull request as ready for review November 18, 2026 10:17
… §Channels)

Grouping called applyMove directly, and inserting (bounce, new tracks)
and duplicating shifted tracks with their own loops, so a key held across
one of those edits released at its old index and stuck. All four paths
that renumber tracks now call tracksRenumbered with their old-to-new map,
which remaps the engine's queued keys and the keys main holds
(live_held, alongside live_audio).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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