Lightningbeam/daw-backend
Skyler Lehmkuhl c62164c365 Cycle recording: MIDI separate-takes mode, and append to existing folders
Completes the cycle-recording spec. Three related pieces:

MIDI separate takes (Preferences > Audio > "Cycle MIDI recording"):
- Each pass becomes its own MIDI clip, folded into a take folder — the same
  shape audio always gets — instead of merging into one clip. Merge stays
  the default.
- Notes are bucketed by the pass they were played in. The pass counter bumps
  BETWEEN close_active_notes and the re-note_on at a wrap, so a key held
  across the boundary has its sounding half filed under the pass that's
  ending and its re-opened half under the pass that's beginning. Put the bump
  on either side of that pair and the whole note lands in one pass; there's a
  test named for exactly that.
- A silent INTERIOR pass still yields an empty take, so take N is always pass
  N — otherwise the numbering silently shifts and "take 3" stops meaning "the
  third time round". A TRAILING empty pass is dropped: that's what hitting
  stop shortly after a wrap gives you, a stop artifact rather than a take you
  played. (Audio already behaved this way via its short-final-take rule.)
- Still triggers on the wrap: stop inside the first pass and it's an ordinary
  single recording, whatever the preference says.

Append to an existing take folder (AppendTakesAction):
- Cycle-recording over a region that already holds a take folder now ADDS to
  that folder rather than dropping a second clip on top of it, which stranded
  the new takes in an overlapping clip you couldn't audition against the old.
- "Same region" means same start AND same loop length: resize the cycle region
  and you get a fresh folder, rather than takes of a different length appended
  to an existing one, which would break the uniform-take invariant that
  comping-via-split depends on.
- The recording's own clip/instance are throwaway scaffolding here (the takes
  already live in the backend pools), so they're discarded; the single
  AppendTakesAction is the whole undoable step.

Don't play the region you're recording over:
- While recording into a MIDI track, every clip on that track is silenced
  EXCEPT the one being recorded into. A take folder already sitting in the
  cycle region was otherwise playing its active take underneath you on every
  pass, fighting the part you were trying to record.
- The recording clip itself is exempt, because in merge mode that's precisely
  what you want to hear: the overdub you've been building up. Other tracks are
  untouched.
2026-07-14 12:10:08 -04:00
..
examples midi import in daw backend 2025-10-18 21:46:40 -04:00
src Cycle recording: MIDI separate-takes mode, and append to existing folders 2026-07-14 12:10:08 -04:00
tests Pack video into .beam and stream frames + audio from the blob 2026-06-22 09:17:10 -04:00
C2.mp3 Work on daw backend 2025-10-18 18:09:07 -04:00
Cargo.lock Type AudioClip duration by clip kind; fix MIDI clips growing too fast 2026-07-11 19:23:37 -04:00
Cargo.toml Pack video into .beam and stream frames + audio from the blob 2026-06-22 09:17:10 -04:00
darude-sandstorm.mid midi import in daw backend 2025-10-18 21:46:40 -04:00
daw_architecture_doc.md Work on daw backend 2025-10-18 18:09:07 -04:00
test.wav Work on daw backend 2025-10-18 18:09:07 -04:00
ttls.mid Add audio node graph editing 2025-10-25 03:29:54 -04:00