Expand description
MIDI file parser โ extracts metadata from Standard MIDI Files (.mid/.midi).
Parses the MThd header and MTrk track chunks to extract:
- Format type (0=single track, 1=multi-track, 2=independent tracks)
- Track count
- Tempo (BPM from meta event 0x51)
- Time signature (from meta event 0x58)
- Note count (total note-on events)
- Duration (in seconds, computed from tempo + tick count)
- Key signature (from meta event 0x59)
- Track names (from meta event 0x03)
Structsยง
Functionsยง
- parse_
midi - Parse a MIDI file and return metadata.
- read_
var_ ๐len - Read a MIDI variable-length quantity. Returns (value, bytes_consumed).