pretty-midi
pretty-midi copied to clipboard
Notes missing in piano roll
get_piano_roll doesn't show some of the notes. You can easily find such cases by choosing a low fs value.
Here instead of int(note.start*fs):int(note.end*fs), a different rounding mechanism might solve the problem, preventing the duration from being 0 for example as follows: int(note.start*fs):max(int(note.end*fs),int(note.start*fs)+1)
Thank you and happy holidays!
I think this is a matter of convention, i.e. if a note falls entirely within a sampling interval should it be included or not? I would welcome a PR to make this behavior configurable (I think int(floor(...)):int(ceil(...)) would make most sense).
FYI, I tried to fix this in PR #195