Open rchrdnsh opened 1 year ago
Not sure if related, but also found that some MIDI's don't signal that it has stopped:
e.g. https://www.mediafire.com/file/ecfn1w70yy9iz8c/%255BSC-55%255D_Jack_Black_-_Peaches.mid/file
I'm experiencing the same thing - it seems to not want to fire the last Note Off message, and the End of Track message (if you can call that a message). You can see it happening like this:
var MidiPlayer = require('midi-player-js');
var Player = new MidiPlayer.Player(function(event) { console.log(event); console.log(Player.getTotalEvents(), Player.eventsPlayed()); });
// Load MIDI file Player.loadFile('./1.mid'); Player.play();
It never reaches the total number of events in the file. Perhaps an order of operations problem?
Got a midi file with a series of events, logged using the getEvents method:
but during playback the last series of note off events and the end of track event do not fire, which leaves the midi events unfinished...
Player.on('endOfFile') does seem to fire, so I cannot figure out why the last few events are not firing...
I'm running this lib in a svelte component, but everything in the code seems to be working ok up until the last series of events...
It seems to happen with every midi file i play, even though they are show that there are note off and end of track events in them.
Here is some of the code being used to run the midi file:
and:
...not getting errors in the console, just does not play all the events to the end of the file...