grimmdude / MidiPlayerJS

♬ MIDI parser & player engine for browser or Node. As a parser converts MIDI events into JSON. Works well with single or multitrack MIDI files.
https://grimmdude.com/MidiPlayerJS/
MIT License
357 stars 52 forks source link

[BUG] File loading broken #57

Closed Andrew-J-Larson closed 4 years ago

Andrew-J-Larson commented 4 years ago

Whenever I try to load this file (500 Miles.mid), it completely crashes the script using your library.

grimmdude commented 4 years ago

Hey @TheAlienDrew ,

It looks like this file has a total byte length of 38,177, however the MIDI chunks only seem to add up to 38,176 so the player is having trouble reaching the end of file when parsing. I'm trying to track down where that extra byte is coming from so perhaps we can catch this issue and correct for it...

-Garrett

grimmdude commented 4 years ago

Ah found it, looks like there's a straggling 0x0a byte at the end of the file. I've made a change to only use the byte length of the combined MIDI chunks instead of the whole file length so this file should work now. Release this in 2.0.8. Thanks for sending,

-Garrett