pretty-midi icon indicating copy to clipboard operation
pretty-midi copied to clipboard

Notes missing in piano roll

Open page200 opened this issue 3 years ago • 2 comments

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!

page200 avatar Dec 25 '21 22:12 page200

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).

craffel avatar Dec 27 '21 19:12 craffel

FYI, I tried to fix this in PR #195

TimFelixBeyer avatar Jan 11 '22 10:01 TimFelixBeyer