I'm want to read a midi file (a Chopin Etude Opus 25 No. 2 from here) using Music21 and then recreate it. When I read the notes from the file all notes that are shorter than a 16th note are "rounded up" and when I use note.quarterLength
it returns 0.25. Am I doing something wrong or is it a limitation in Music21?
Here's how I read the file:
for file in glob.glob(midi_folder + '/*.mid'):
midi = converter.parse(file)
midi_notes = None
try:
instruments = instrument.partitionByInstrument(midi)
for inst in instruments:
if inst.partName == 'Piano':
midi_notes = inst.recurse()
break
except:
midi_notes = midi.flat.notes
for element in midi_notes:
# do stuff with the note ...