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
359 stars 52 forks source link

Tempo bug with this file #45

Closed binyamin closed 5 years ago

binyamin commented 5 years ago

Issue This midi file doesn't have the correct tempo when played. The console shows a 60bpm tempo. The tempo begins at 50bpm, and subsequently changes to 80bpm after a few bars.

Steps to reproduce the issue

  1. The repo with the project I used to run the file is here
  2. The build folder contains the compiled code for windows.
  3. run the program, click load file, and choose a file. It will play automatically.
  4. The console (ctrl/cmd+shift+I) shows the midi output.

Notes The relevant code is in src/index.js.

binyamin commented 5 years ago

Found a relevant issue. #28

binyamin commented 5 years ago

Okay, so I added the following code block to src/index.js, and the code responds to tempo events now. But it interprets them incorrectly. The tempo begins as image, then changes to 80. It works correctly with a 4/4 time signature.

if(event.name === 'Set Tempo') {
     Player.setTempo(event.data);
}