craffel / pretty-midi

Utility functions for handling MIDI data in a nice/intuitive way.
MIT License
873 stars 151 forks source link

Out of memory when loading MIDI file #182

Closed AI-Guru closed 4 years ago

AI-Guru commented 4 years ago

Hello,

I really like pretty-midi. Great work!

There seems to be a problem with some files. I have attached one.

If I run this code:

import pretty_midi as pm
pm.PrettyMIDI("79fe18e50fb30cd1679e3a9e0960620.mid")

after a while the script terminates because it ran out of memory.

Any ideas?

a79fe18e50fb30cd1679e3a9e0960620.mid.zip

AI-Guru commented 4 years ago

It looks like the MAX_TICK check does not work. The reason is that MAX_TICK somehow (and that puzzles me) becomes 1e10, where I expect it to be 1e7. That is very very strange.

Setting MAX_TICK by hand before loading the files does not work.

craffel commented 4 years ago

Hi, it raises the "MIDI file has a largest tick of ..." ValueError as expected for me and MAX_TICK stays at 1e7. Maybe you are importing some code that overrides MAX_TICK?

AI-Guru commented 4 years ago

This is EXACTLY what happened!