Skip to main content

read_smf

Function read_smf 

Source
pub fn read_smf(bytes: &[u8]) -> Result<SmfFile, AudioError>
Expand description

Parse a complete Standard MIDI File byte buffer.

Validates the MThd header (must declare format 0/1/2 and a 6-byte body), then parses exactly ntracks MTrk chunks. Non-MTrk chunks encountered where a track is expected are rejected. Returns AudioError::MalformedAudio for structural problems and AudioError::UnsupportedFormat for an unknown SMF format number.