Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
Research: Articulation maps
Phase 0 of /speckit-plan. Each decision names what was verified in the repository and what
was not. "Unverified" means no code or file in this checkout proves it.
R1. Where articulation data lives in the engine
- Decision: The map is engine state on the instrument track, as two things published
together with the graph snapshot: (a) an opaque JSON blob (what the project saves and undo
restores) and (b) a compiled, immutable
ArticulationTablethe audio thread reads. A note carries only an integer articulation id. - Rationale: The engine owns undo (
pushUndo, graph snapshots throughrepublishWithTrack). If the map lived only in managed code, undo would restore notes but not the map. Putting it in the track makes assign, edit, undo, redo, duplicate-track and save all follow the existing path (AR-5: immutable snapshot published, the audio thread never sees a half-built table). - Alternatives: Managed-only catalog with the engine holding a copy (rejected: two sources of truth, undo drift). Per-note inline actions (rejected: bloats notes, loses "edit the map once").
- Verified:
Trackfields are copied incloneTrack(Engine.cpp~675) and the duplicate path (Engine_Tracks.cpp~3672); clip controllers are already shared immutableshared_ptrs (MidiClip.h), the same pattern.
R2. How articulation MIDI reaches the instrument
- Decision: Articulation actions are not put in the note stream. The scheduler builds a
separate, sorted
ArtEvlist per block andplayEventsmerges it with notes and expression.ArtEv={off, seq, kind, channel, data1, data2}; equal offsets keepseq(action order). - Rationale: MIDI effects (
applyMidiEffects, e.g. the arpeggiator) transform the note stream aftergatherInstrumentNotes. A keyswitch placed in it would be arpeggiated or filtered. Keyswitches must bypass MIDI FX.std::sort(midiEvLess)is not stable, so actions that must stay in file order need their own sequence key. - Alternatives: Prepend keyswitch notes to the note list (rejected: MIDI FX, sort order). Send from the message thread (rejected: breaks sample accuracy and AR-4/AR-6).
- Verified:
computeInstrumentMidisorts, runs the DrumRack swing and MIDI FX, thenplayEventsdelivers;playEventsalready mergesMidiEvandExprEvby offset and has a timed-events path for hosted plug-ins.
R3. Channel, program change and bank select on the Instrument interface
- Recipient gate (implemented):
Instrument::takesArticulations()defaults to false; hosted plug-ins return true, as do racks containing one. Built-in instruments therefore receive no articulation actions. This avoids treating a library's keyswitch as a musical note on a built-in synth. Note timing offsets still apply. The user guide documents the gate. - Decision: Add
int32_t eventChannel = 0besideeventOffset(0 = the note's own / channel- and
virtual void programChange(int32_t program)(default: ignore). Bank select goes through the existingcontroller()path with CC 0 and CC 32.PluginInstrumentuseseventChannel + 1instead of its hardcoded1, and mapsprogramChangetojuce::MidiMessage::programChange. Built-ins ignore both.
- and
- Rationale:
eventOffsetalready shows how to hand per-event data to an instrument without changing everynoteOnsignature across built-in instruments. - Verified:
PluginInstrument.cpphardcodes channel 1 innoteOn,noteOff,controller,allNotesOff;controller()accepts ctl 0..127 as a CC with the value quantised throughu7(v) = lround(v*127), so a CC value N is sent asN/127.0fand round-trips exactly. - Unverified: that Kontakt reacts to program change or bank select. CSS needs neither (its files use keyswitch notes and CC 58, seen in the owner's files).
- Implemented (T018):
PluginInstrumentsends every engine-driven event onchan()(the articulation's channel, else 1) and remembers which channels it used, soallNotesOffflushes channel 1 plus only those (a plug-in never driven off channel 1 still gets exactly one message). ItsMidiBufferis pre-sized to 8 KiB, so the extra messages don't allocate.RackInstrumentforwards the channel with controllers and program changes to every chain. - Limit (racks): a keyswitch note sent to an Instrument Rack goes through the rack's note fan-out like any note: chain key/velocity zones and chain MIDI effects apply, and it reaches the chain on channel 1. A plug-in hosted directly on the track has neither limit. Documented for the user manual (T079).
R4. Offsets and the lead time (the scheduling rule)
- Decision:
effective = nominal + trackOffsetMs + articulationOffsetMs;trigger = effective - leadMs. Milliseconds convert to samples with the device sample rate (ms * sr / 1000), not through samples-per-beat. A note-on is emitted in the block that contains its effective time; the actions in the block that contains the trigger time. Note-off uses the same shift as note-on (length preserved). - Rationale: The engine decides what plays by comparing sample positions with the block window
(
gatherInstrumentNotes). Shifting the sample position is the smallest change that preserves every existing rule (clip active, clip end, seams, chase). - Consequences (documented limits, spec FR-023):
- Playback that starts inside
[effective, nominal)of a note: its note-on is already past. The existing chase rule re-triggers it late only if the note is still held (offS > blockStart); a shorter note is not played. This is the "cannot be scheduled early" case. - A positive offset can push a note past a loop end; the transport wraps first, so it is not played in that pass.
- A negative offset on a note at the loop start cannot sound before the wrap in the first version. Lookahead across the loop seam is a later task (see Plan, Phase C).
- Playback that starts inside
- Verified: the first slice (track offset applied to
onS/offSingatherInstrumentNotes) is already written; it is not yet built or tested.
R5. Keyswitch state without runtime state
- Decision: The scheduler is stateless per block. At publish time (message thread) each clip
with a map gets a derived, immutable articulation timeline: notes sorted by start, with
consecutive latching notes of the same articulation collapsed to one change point; momentary
articulations stay one entry per note. At run time a block emits the change points whose trigger
time falls in the block; on a seek, loop wrap or start (
chaseNotes_) it also emits the articulation in force at the block start, found by binary search, at offset 0. - Rationale: Dedupe ("no duplicate triggers") and "restore state after a seek" both need to know the previous articulation. Scanning all notes per block for it is O(n²) in the worst case; keeping state on the audio thread breaks on seeks. A precomputed timeline makes both exact and allocation-free.
- Choke point (T012, traced 2026-11-09):
Engine::publishRaw(Engine.cpp). Every graph the audio thread can see passes through it:publish→publishRaw;republishWithTrack→republishWithTrackRaw→publishRaw(84 + 23 callers); 30 direct callers including undo/redo (restored = true). The only othergraphHist_.publishis the constructor's empty graph. All 37 writes tonotes/midiClipsinsrc/engine/*.cpp(note set, recording incl. session takes and pickup shifts, split, trim, slice, consolidate, move between tracks, duplicate, take retry) are made on a freshcloneTrackcopy or on a new local clip pushed into one, before that copy is published. No code edits notes on a published track in place. - Where the timeline is rebuilt: in
publishRaw, beside the existingsettleTakeJoinspass, which already does the same thing for derived take joins: for each track of the new graph that is not shared with the currentauthoring_graph (a fresh clone the audio thread has never seen), rebuild the timeline of every MIDI clip and Session slot clip from its notes and the track's table; with no table, clear them (a clone copies its source's timelines). Tracks shared with the current graph are untouched. Restored tracks (undo, redo) were published before with a timeline that matches their notes and table, so they need nothing. A track without a map costs nothing. - Cost: O(n log n) per clip of an edited track that has a map, on the message thread; a
live piano-roll drag (
setClipNotesLive) pays it per frame. To be measured in T072. - Alternatives: Re-send the keyswitch before every note (rejected: breaks legato scripts and FR-021 "no duplicate triggers"). Hold "last sent" in the instrument (rejected: wrong after a seek).
R6. Latching and momentary keyswitch release
- Decision: A latching keyswitch note is released after a fixed 20 ms hold (a named constant); a momentary one is released when its note ends. Both are scheduled by time, statelessly, like note-offs. Controller, program and bank actions have no release.
- Rationale: Cubase sends a keyswitch note-on and a note-off right away for its "direct" articulations. 20 ms is long enough for any script to see it and short enough to avoid overlapping the next trigger.
- Unverified: the exact hold some Kontakt scripts want. Exposed as a constant; if a library needs more, make it a per-articulation field.
R7. Session clips
- Decision: Session slots get the same offset and articulation path, implemented after the
Arrangement one by sharing one helper.
renderSessionSlotRawalready scans the current and next loop iteration, so a shifted note near the slot end naturally lands in the next iteration. - Verified:
renderSessionSlotRawiteratesit = i0..i0+1and testsonAbsagainst[p, p+db).
R8. Persistence
- Decision:
TrackDto.ArticulationMap(the map as Nota's file format, spec incontracts/nota-articulation-map-file.md),TrackDto.MidiOffsetMsandNoteDto.Articulation(the last two already written), format version 30 with a no-op migration. A user library folderNotaPaths.SubDir("articulations")holds the same JSON for reuse across projects. - Verified:
NotaPaths.SubDir, thePresetStorepattern and[JsonExtensionData]exist. Unknown properties survive a load/save cycle, so older builds that read a v30 file lose nothing they did not understand (they refuse files with a higher version, as today).
R9. Importers (what is and is not known)
| Format | Evidence | Parsed | Not stored in the file |
|---|---|---|---|
Cubase .expressionmap |
Real file: Art Conductor "CSSS Violins 1 A" (45 slots) | names, short names, descriptions, order, output events {status,data1,data2} (144 note, 176 CC), palette colour index, group number |
switch mode, RGB colour, group names |
Studio One .keyswitch |
Real file: "CSSS Violins 1 Attribute" (+ Lite Ensemble); entries cross-checked against the Cubase twin | names, ids, keyswitch notes (noteP.V), original activation string |
colours, groups, channels, the CC that CSS uses (unknown) |
Studio One .soundvariation |
No file seen | nothing: not implemented | n/a |
- Cross-check result (from the real files): all 44 non-empty entries have the same keyswitch notes
in both formats;
noteP.Vis velocity V andnotePis velocity 127;unknownis the CC 58 action the keyswitch format cannot hold. - Not verified because no file shows it: program change and bank select in Cubase maps, non-zero groups, the slot-level channel field when it is not -1, momentary vs latching.
- The importers use
System.Xml(base class library), DTD processing prohibited, size bounded.
R10. Library presets and automatic measurement
- Library Preset mode: Nota will not ship recommended offsets it cannot source. Presets are user-saved sets of offsets that can be applied and overridden. Values for a named library are added only when the owner supplies them or measurement produces them.
- Automatic Measurement: plausible, unverified. The engine can bounce a track's audio offline
(
freezebegin/end) and has offline rendering. A measurement would need an ABI to inject a probe keyswitch and note into the track's instrument during an offline render, then an onset detector (TempoDetecthas an onset-novelty envelope to reuse). Whether a hosted Kontakt instance renders correctly in that offline path is unknown and needs the owner's machine. Scheduled last (Phase F); the report must say "not verified" unless it is.
R11. UI integration points (located; behaviour not yet read)
Piano-roll note colour:
NoteGrid.RenderinPianoRollView.csuses_o.ColorOf(i)for the normal branch; selected, ghost and locked branches are separate. Hook point for Articulation Color.Note context menu: a right-click path on
NoteGridwas not located; the first UI task finds it.MenuFlyout+MenuKit.Itemis the pattern (ShowResetMenu, controller picker).Inspector: new "Articulations" section in
TrackInspectorView.cs, gated byIsInstrument.Drop:
BrowserView.ExternalPathsand the Mosaic SFZ drop (HookDrop) are the patterns.Note rebuilds (T011, audited 2026-11-09). Searched
src/managedfornew NotaNote(, target-typednew(x.Pitch…), initializers anddefault(NotaNote), andsrc/nativeforNotebuilt from fields:Site What it does Verdict Nota.Mcp/Tools/MidiTools.csToEngine/FromEngineMCP get_clip_notes→ agent edits →set_clip_notesWas lossy; fixed: optional Articulationon the MCPNoterecord, mapped both waysNota.Mcp/Tools/SessionTools.csToEngine/FromEnginesame for Session slots Was lossy; fixed the same way Nota.App/PianoRollView.cs:2409a click draws a new note new note: none is correct Nota.App/DrumPatternView.cs:181step sequencer creates notes new note: none is correct Nota.App/MainWindow.Convert.cs(4 sites)audio → MIDI conversion new notes: none is correct Nota.Application/Midi/MidiFileReader.cs:102MIDI file import new notes: none is correct Nota.Application/Ports/IClipAi.cs:38AI-generated notes new notes: none is correct Nota.Application/Twin/TwinPatterns.cs:307pattern generator new notes: none is correct Engine_Render.cpp479/535 (collectRecorded)recorded notes into a take new notes: none is correct Engine_Tracks.cppnoteFromDataABI → Notecarries the id (T004) MidiTransforms,NoteOverwriteandClipSet(named earlier as suspects) copy notes as values (var c = n; c.StartBeat = …) and never rebuild them; the struct copy keepsArticulationId. Native split, trim, consolidate and duplicate copyNoteby value. Behavioural proof that edits keep the id is T045.
R12. Build and test environment
- Resolved 2026-11-09: the native CMake configure downloads CPM and its pinned dependencies
(nlohmann_json, JUCE, miniaudio, signalsmith and others). No offline cache existed, so the owner
allowed the download. They now live in
src/native/nota.engine/build/_deps(git-ignored). The native engine builds with MSVC x64 + Ninja (324 steps, 0 errors), the scanner self-test passes, and the full smoke test passes. - Managed code builds today without the engine (
Nota.Applicationcompiled). Engine-dependent smoke tests need the native library. - The importer tests are pure managed code and can run as soon as the smoke-test project builds.
- Git Bash exists (
C:\Program Files\Git\bin\bash.exe), so.specify/scripts/bash/*can run if needed; no script here needs a branch.