Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
Research: Loop record mode — Overdub / Replace
R1 — Where a "pass" is known
- Decision: The audio thread counts passes.
Engine::onLoopWrap(added by the seam fix) incrementsrecordPass_while an Arrangement MIDI take is recording. EveryRecordedNotecarries thepassit started in. - Rationale: The wrap happens on the audio thread, block-accurately, and
onLoopWrapalready splits held notes there. The head of a split note keeps the old pass, and the continuation (restarted at the loop start) gets the new pass. That is exactly spec AS-1.3. - Alternatives: Derive the pass on the message thread from note start beats plus the loop length. Rejected: a pass is a time span, not a beat range (beats repeat every pass), so start beats cannot tell passes apart.
R2 — What triggers a replace
- Decision: The trigger is a fresh note-on of the take (live keyboard on the record track, or routed MIDI captured into it) whose pass is greater than the last replaced pass, while the pass's latched mode is Replace. It sets
replaceUpTo_(an atomic with release semantics) to that pass. The continuation of a note held across the seam is not a fresh note-on, so it does not trigger. - Rationale: Clarification Q1 says whole earlier passes are removed at the first note of the new pass. FR-004 says a silent pass removes nothing. If a held continuation triggered the replace, holding a final chord over the seam would wipe the pass that chord belongs to.
- Alternatives: Trigger on the first released note. Rejected because the removal would lag the press by the note's length, and FR-010 wants the take view to update as you play.
R3 — Mode switch timing
- Decision: The message thread writes the mode to an atomic (
loopRecordReplace_). The audio thread latches it intopassReplace_at take start and at every wrap. Triggers use the latched value. - Rationale: FR-007 says a switch applies from the next pass. Latching at the wrap gives that with one relaxed load per wrap.
R4 — Removing earlier passes on the message thread
- Decision:
collectRecorded(message thread,Poll) first loadsreplaceUpTo_with acquire semantics, then drainsrecorded_, so every note of an earlier pass that was pushed before the trigger is already in the batch. It appends the batch. Then, ifreplaceUpTo_has grown, it removes from the take clip each note recorded by this take withpass < replaceUpTo_, and drops any late arrival withpass < replaceUpTo_. The take's notes are tracked in a message-thread listtakeNotes_of{pitch, absStartBeat, pass}. Clip notes are matched by pitch and absolute start (ε = 1e-6 beat), so the matching survives the clip's left edge moving (count-in pickups) and other notes being reordered. - Rationale: FR-005 says notes in the clip before the take must stay. Matching by identity (not by index) keeps those notes untouched. The edit goes through the same
republishWithTrackRawas the growing take, so the whole take stays one undo step (spec edge case) and stays AR-5 compliant: an immutable snapshot published from the message thread. - Alternatives: A parallel per-index pass array. Rejected because it is fragile when the clip shifts or the user edits notes during recording.
R5 — Held-note preview
- Decision: No change to the snapshot ABI. The preview shows held (pending) notes, and those always belong to the current pass. The replaced notes disappear when the next
Pollrepublishes the clip, at most one UI tick (~33 ms) after the trigger.
R6 — Scope boundaries
- Session slot recording (
recordSlotPlayer_set) never counts passes and never replaces (spec edge case). - Loop off: there are no wraps, so
recordPass_stays 0 and nothing is ever replaced. - Audio loop punch is unchanged.
R7 — UI and shortcut
- Decision: A
cellToggleButton in the transport console, right after the Loop cell, labelled Overdub / Replace (sentence case, per DESIGN.md). The accent shows only while it reads Replace, since Overdub is the default resting state. A new commandtransport.loopRecordMode, "Loop record: overdub / replace", bound to ⌘⇧R (free inCommandCatalog: ⌘R is Record, and the shift variant reads as "record mode"). A menu item goes under Transport next to Loop and Metronome. The setting persists asSettings.LoopRecordReplace(bool, default false), mirroringCountInBars. - Alternatives: The right-click menu on Record (Q3 option B) and menu-only (Q3 option C) were rejected by the user.
R8 — MCP
- Decision:
get_transportgainsLoopRecordReplace. A new toolset_loop_record_mode(replace: bool)sets the engine and the app setting through the same transport view-model path the UI uses (FR-012).