Expand description
Standard MIDI File (formats 0/1/2) read/write + tempo map. Re-exports only.
Lane AU-MIDI-FILE. Native, dependency-free SMF I/O under the Qualia ABI:
read_smfparses an SMF byte buffer into anSmfFile(expanding running status);write_smfserializes it back with deterministic, round-trippable bytes.build_tempo_map/TempoMapconvert ticks ↔ seconds given the file’sDivision.read_vlq/write_vlqandparse_meta/serialize_metaare the low-level codecs.
Structs§
- Event
- A delta-timed track event.
- SmfFile
- A parsed Standard MIDI File.
- Tempo
Entry - One tempo change at an absolute tick position.
- Tempo
Map - An ordered tempo map for one SMF, with its time division.
- Track
- One MTrk track: an ordered list of delta-timed events.
Enums§
- Division
- SMF time division (the MThd
divisionfield). - Meta
Event - A parsed SMF meta-event payload.
- Track
Event - A single track event: MIDI channel message, meta-event, or system-exclusive.
Constants§
- DEFAULT_
US_ PER_ QUARTER - Default tempo before any tempo meta-event: 120 BPM = 500000 µs/quarter.
- META_
END_ OF_ TRACK - META_
KEY_ SIGNATURE - META_
SEQUENCE_ NUMBER - Meta-event type bytes (the
<type>after0xFF). - META_
TEMPO - META_
TIME_ SIGNATURE - META_
TRACK_ NAME - VLQ_MAX
- Largest value representable in a 4-byte SMF VLQ (28 bits).
Functions§
- build_
tempo_ map - Build a
TempoMapfrom a parsed SMF. - parse_
meta - Decode a meta-event from its type byte and payload
data(the bytes after the VLQ length, exactlylenof them). - read_
smf - Parse a complete Standard MIDI File byte buffer.
- read_
vlq - Decode a VLQ from the front of
bytes. - serialize_
meta - Serialize a meta-event as
0xFF <type> <vlq len> <data>, appended toout. - write_
smf - Serialize an
SmfFileto a fresh byte buffer. - write_
vlq - Encode
valueas a VLQ appended toout.