Skip to main content

Module smf

Module smf 

Source
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:

Structs§

Event
A delta-timed track event.
SmfFile
A parsed Standard MIDI File.
TempoEntry
One tempo change at an absolute tick position.
TempoMap
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 division field).
MetaEvent
A parsed SMF meta-event payload.
TrackEvent
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> after 0xFF).
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 TempoMap from a parsed SMF.
parse_meta
Decode a meta-event from its type byte and payload data (the bytes after the VLQ length, exactly len of 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 to out.
write_smf
Serialize an SmfFile to a fresh byte buffer.
write_vlq
Encode value as a VLQ appended to out.