Expand description
Pair a stream of timed MIDI events into whole notes (note-on matched to its
note-off).
Lane AU-MIDI-BRIDGE. The input is a tick-ordered slice of
crate::midi::sequencer::TimedEvent — the sequencer’s event currency, and
the natural flattened form of an authored crate::midi::smf track (each
delta-timed crate::midi::smf::TrackEvent::Midi carries a status + data
bytes at an absolute tick). This function walks that stream, matches each
note-on to the next note-off (or velocity-0 note-on, the running-status note
off) on the same channel + note, and emits one PairedNote per completed
note with its start_tick, end_tick, and attack velocity.
§Epistemic contract — authored MIDI is AUTHORITATIVE
Notes paired here come from authored / imported MIDI (a sequencer track or
a parsed SMF), which is authoritative ground truth — unlike transcribed
proposals produced by super::from_pitch_midi. This function adds no
confidence field because none is warranted: an authored note is asserted, not
proposed. Callers must not blend a PairedNote with a transcription
proposal without tracking which stream it came from.
Zero-heap: pairing state lives in a fixed on-stack table; completed notes are
written into the caller-supplied out slice.
Structs§
- Paired
Note - A whole note recovered by pairing a note-on with its note-off.
Constants§
- MAX_
OPEN_ NOTES - Maximum number of notes that may be sounding simultaneously while pairing. A stream with more than this many concurrently-open note-ons is rejected.
Functions§
- pair_
note_ events - Pair a tick-ordered timed-MIDI stream into whole notes.