Open FelixDeMan opened 3 years ago
Hope this is still relevant, there is a small bug in the utils/midifile.py. During preprocessing this script validates the midifiles and extracts only the relevant Miditracks. However during this track selection step the get_track_instrument function looks for PROGRAM_CHANGED messages by comparing the music21 MidiEvent type to the string 'PROGRAM_CHANGED', whereas the event type is a enum of type ChannelVoiceMessages.
In summary change following line in the utils/midifile.py line 98:
def get_track_instrument(t):
for idx,e in enumerate(t.events):
#if e.type == 'PROGRAM_CHANGE': return e.data <-- issue here
if e.type == ChannelVoiceMessages.PROGRAM_CHANGE:return e.data # <-- my fix
return None
When trying to preprocess my midi files (using the DataPreProcessing notebook), it keeps on returning None when
in the transform_midi function.
This leads to no conversion to npy's of my midi files