Use chunk length to read MIDI files

This MR uses the chunk length to read the MIDI files instead of trying to guess were each track ends. This made it much more compatible with a variety of MIDI files. Tested in a collection of 60k+ MIDI files.

  • Use chunk length to read tracks instead of using the meta EndOfTrack message. This is the way recommended in the specification. No need to check amount of processed tracks also.
  • When finding a invalid canary, the spec says to ignore it, but don't say how many bytes to read. Analyzing other libraries, all of them read 1 byte in this case, and in the big sample of midi files I have, it worked perfectly.

Merge request reports

Loading