You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, midi reads in a MIDI file with has NoteOnEvents with data[0] > 127:
In [1]: importmidiIn [2]: m=midi.read_midifile("data/clean_midi/mid/Celine Dion/That's The Way It Is.mid")
In [3]: fortinm:
...: foreint:
...: iftype(e) ==midi.NoteOnEvent:
...: ife.data[0] >127:
...: printe
...:
midi.NoteOnEvent(tick=4656, channel=7, data=[253, 75])
midi.NoteOnEvent(tick=0, channel=7, data=[254, 75])
midi.NoteOnEvent(tick=48, channel=7, data=[253, 0])
midi.NoteOnEvent(tick=0, channel=7, data=[254, 0])
This is because midi just loads in data via ordhttps://github.com/vishnubob/python-midi/blob/master/src/fileio.py#L94, so as long as the argument is a 8-bit char it will happily set a data value to a number more than 127. So, this likely happens for other events too, not just NoteOnEventsdata[0]. This can create issues later on. Either midi should raise an exception, we should raise an exception, or we should issue a warning and ignore those events with invalid data values.
The text was updated successfully, but these errors were encountered:
Sometimes,
midi
reads in a MIDI file with hasNoteOnEvents
withdata[0] > 127
:This is because
midi
just loads in data viaord
https://github.com/vishnubob/python-midi/blob/master/src/fileio.py#L94, so as long as the argument is a 8-bit char it will happily set a data value to a number more than 127. So, this likely happens for other events too, not justNoteOnEvents
data[0]
. This can create issues later on. Eithermidi
should raise an exception, we should raise an exception, or we should issue a warning and ignore those events with invalid data values.The text was updated successfully, but these errors were encountered: