It seems to be a problem with the midi to tsv conversion. In the original Onsets and frames paper it says:
"If a note is active when sustain goes on, that note will be extended until either sustain goes off or the same note is played again. This process gives the same note durations as the text files included with the dataset."
I noticed that I don't get the same offsets as in the text files, and then I saw that when moving the offset, you search for sustain off but not also for a new onset of the same note. Or did you omit this for a reason?
Adding what's in bold to line 45 from midi.py seems to have the result I desired:
offset = next(n for n in events[offset['index'] + 1:] if n['type'] == 'sustain_off' or n['note'] == offset['note'] or n is events[-1])
It seems to be a problem with the midi to tsv conversion. In the original Onsets and frames paper it says:
"If a note is active when sustain goes on, that note will be extended until either sustain goes off or the same note is played again. This process gives the same note durations as the text files included with the dataset."
I noticed that I don't get the same offsets as in the text files, and then I saw that when moving the offset, you search for sustain off but not also for a new onset of the same note. Or did you omit this for a reason?
Adding what's in bold to line 45 from midi.py seems to have the result I desired:
offset = next(n for n in events[offset['index'] + 1:] if n['type'] == 'sustain_off' or n['note'] == offset['note'] or n is events[-1])