pretty-midi
pretty-midi copied to clipboard
Fix get_piano_roll pedal implementation
I'm not entirely sure whether I precisely understand the desired output of get_piano_roll. However, after comparing it with https://github.com/magenta/note-seq/tree/master and the piano-roll from there I think there are two small issues with it: One is an off-by-one error and the other happens when a note offset happens just before/after the pedal is pressed down:
Due to rounding, the pedal might be pressed after the note offset has already occurred. For example, both offset a and offset b round to t0, and would be held:
t0--------->t0+fs
| * | pedal
| * | offset a -> should not be held
| * | offset b -> should be held
Again I'm not sure whether the spec of get_piano_roll is different from other piano rolls. I think regardless of that, the pedal issue should be addressed.
@maezawa-akira added the sustain pedal functionality, maybe he can comment?
It seems like @maezawa-akira is not active on GitHub anymore. How would you like to proceed?
after comparing it with https://github.com/magenta/note-seq/tree/master and the piano-roll from there
@TimFelixBeyer I can't find the documentation under this link. Do you have code at hand for creating a piano roll from a MIDI file in magenta?