Search code examples
midi

MIDI file has a largest tick of 11222570, it is likely corrupt: How to solve?


I am using the pretty-midi library to load MIDI files for machine learning. However, I am encountering the error message ValueError: MIDI file has a largest tick of 11222570, it is likely corrupt when attempting to load some of the files with pm = pretty_midi.PrettyMIDI(midi_file). I am able to play these supposedly corrupt files normally using VLC, so I think they are actually valid.

Is there a way to resolve this error and successfully load these MIDI files using pretty-midi?


Solution

  • By the pretty-midi project this is indeed considered a bug in the file: https://github.com/craffel/pretty-midi/issues/112

    A workaround is described.