forked from craffel/pretty-midi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
craffel#131 Fix a problem when reading tracks with overlapping notes.
In particular when there are two adjacent notes and at the same tick there's first note-on and then note-off, the library incorrectly closes both notes, even though the second note should be still open. Such a MIDI is probably a bit malformed, but the library should not fail on that if it can resolve the situation. Due to this bug the library incorrectly produces zero-duration events and some long open notes. The solution is to keep the note-on event in the list of open notes if it's at the same tick as the note-off event and we're closing some previous notes. Note that we changed the format of time within values of the last_note_on dict - from real time to integer tick. This is to avoid floating point comparison when we have the original integer values.
- Loading branch information
Showing
1 changed file
with
40 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters