Repository navigation
Conversation
The decoder read any byte with a high nibble of 15 as an "End of Track" event and stopped there. A MIDI track conventionally opens with a Set Tempo meta event, which begins 0xFF, so for most real files the track ended before a single note was played and the sample was silent. Meta and System Exclusive events both carry an explicit length, so skip exactly that many bytes instead of guessing, and end the track only on an actual End of Track meta event. Decoding the first 30 seconds of a stock Bach Toccata now yields 479 and 423 note events on its two note tracks, where it previously yielded 2 and none. Also report error_location as the offset where the error was found rather than the end of the track it was abandoned at. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Status note covering this stack (#34–#38). Verified on an Adafruit FunHouse that The parser fixes themselves are verified on the host rather than on the device: each is cross-checked against |
MidiTrackread any byte with a high nibble of 15 as an "End of Track" event and stopped there. A MIDI track conventionally opens with a Set Tempo meta event, which begins0xFF, so for most real files the track ended before a single note played and the sample was silent.Meta and System Exclusive events both carry an explicit length, so this skips exactly that many bytes instead of guessing, and ends the track only on an actual End of Track meta event. Also reports
error_locationas the offset where the error was found rather than the end of the track it was abandoned at.Effect. Decoding the first 30 seconds of a stock Bach Toccata (mfiles.co.uk, format 1, 256 ticks/beat):
Verification. No hardware. I mirrored the decoder before and after in Python and cross-checked against
adafruit_midi_parseras an independent oracle on hand-built files; the new decoder matches it exactly where the old returned nothing. Builds clean forcircuitplayground_bluefruit(arm) andadafruit_funhouse(xtensa).Size. About +272 bytes of flash on nrf52840.
First of five stacked micro-PRs fixing
MidiTrack's MIDI parsing; the rest build on this branch.🤖 Generated with Claude Code