grimmdude / MidiPlayerJS

♬ MIDI parser & player engine for browser or Node. As a parser converts MIDI events into JSON. Works well with single or multitrack MIDI files.
https://grimmdude.com/MidiPlayerJS/
MIT License
357 stars 52 forks source link

Fix black midi "lag" issue #71

Closed player879 closed 3 years ago

player879 commented 3 years ago

In midi-player-js, there was an issue where only one event per track can play in each interval loop (by default every 5 milliseconds.) This would result in the player appearing to lag when a lot of notes are played at once, such as in black midis. This fix makes it continue to do a playLoop until it has fully caught up on events. This may not be the most efficient way to fix this issue, but it seems to fully fix it, as opposed to setting sampleRate to 0 which only makes the issue harder to see. https://github.com/grimmdude/MidiPlayerJS/issues/25 edit: moved pull request to my other account