MidiPlayerJS icon indicating copy to clipboard operation
MidiPlayerJS copied to clipboard

Song plays way too fast than it should be

Open Andrew-J-Larson opened this issue 4 years ago • 6 comments

Here's the sample midi file: 72257.mid

It's like 2-4 times faster than it should be.

Andrew-J-Larson avatar Jul 23 '20 07:07 Andrew-J-Larson

Hey @TheAlienDrew,

Thanks for your message. When I play this file in the demo it to plays at 120bpm which seems correct. Should it be playing at a different tempo?

https://grimmdude.com/MidiPlayerJS/

grimmdude avatar Sep 13 '21 02:09 grimmdude

Hey @TheAlienDrew,

Thanks for your message. When I play this file in the demo it to plays at 120bpm which seems correct. Should it be playing at a different tempo?

https://grimmdude.com/MidiPlayerJS/

It's not necessarily the tempo that's wrong, at least I don't remember for sure. I think there was some issues where tempo wouldn't play correctly for portions of the song. And, there was definitely an issue with it calculating the correct amount of time.

Andrew-J-Larson avatar Sep 13 '21 02:09 Andrew-J-Larson

I'm also having this issue, specifically with midi files that i export from Ableton. I haven't had this issue with midi files i export from Musescore so far.

jdlee022 avatar Oct 01 '22 01:10 jdlee022

I'm also having this issue, specifically with midi files that i export from Ableton. I haven't had this issue with midi files i export from Musescore so far.

That's actually some pretty specific and possibly useful information... I wonder what the difference is between the two that export midis...

Andrew-J-Larson avatar Oct 01 '22 01:10 Andrew-J-Larson

So apparently midi files exported from Ableton do not include a tempo map, and will default to some bpm (i think 120). I searched quite a bit and the only solution to this that I've found is to import my midi file to a 3rd party program such as Musescore, edit the bpm, and export it from there. After that, I get the expected tempo and runtime when using MidiPlayerJS.

I'm not sure where you got your midi file from @TheAlienDrew, but i suspect other DAWs might lack tempo data from their midi file exports. IMO this does not seem like a bug on MidiPlayerJS's side, but rather the file that is fed into it.

jdlee022 avatar Oct 01 '22 17:10 jdlee022

So apparently midi files exported from Ableton do not include a tempo map, and will default to some bpm (i think 120). I searched quite a bit and the only solution to this that I've found is to import my midi file to a 3rd party program such as Musescore, edit the bpm, and export it from there. After that, I get the expected tempo and runtime when using MidiPlayerJS.

I'm not sure where you got your midi file from @TheAlienDrew, but i suspect other DAWs might lack tempo data from their midi file exports. IMO this does not seem like a bug on MidiPlayerJS's side, but rather the file that is fed into it.

Doing some research myself, I think the difference between Ableton and DAWs like it, vs something like MuseScore, Ableton likes to use a master BPM/tempo (used throughout the song where no tempo change is marked in the file format). I assume when there's a temporary tempo change in Ableton, there is nothing marked at the end suggest a new tempo (aka, midi should look for the master tempo again) whereas MuseScore likely puts the master tempo as another tempo change between temporary tempo changes.

This would explain why some midi is act faster than others and why exporting a new score works just fine versus something like Ableton... In which case maybe has another functionality in that it doesn't need tempo changes back to the master tempo as long as some identifier is seen (of which I don't know because I can't reverse engineer any midi files myself) but I'm sure there is something there, given MIDI files from both will still play normally in things such as VLC and other music programs that support midi files.

Andrew-J-Larson avatar Oct 01 '22 23:10 Andrew-J-Larson

So apparently midi files exported from Ableton do not include a tempo map, and will default to some bpm (i think 120). I searched quite a bit and the only solution to this that I've found is to import my midi file to a 3rd party program such as Musescore, edit the bpm, and export it from there. After that, I get the expected tempo and runtime when using MidiPlayerJS.

I'm not sure where you got your midi file from @TheAlienDrew, but i suspect other DAWs might lack tempo data from their midi file exports. IMO this does not seem like a bug on MidiPlayerJS's side, but rather the file that is fed into it.

Doing some research myself, I think the difference between Ableton and DAWs like it, vs something like MuseScore, Ableton likes to use a master BPM/tempo (used throughout the song where no tempo change is marked in the file format). I assume when there's a temporary tempo change in Ableton, there is nothing marked at the end to suggest a new tempo (aka, midi should look for the master tempo again) whereas MuseScore likely puts the master tempo as another tempo change between temporary tempo changes. Assumably, this might mean that any files exported from you score are going to be a little bigger than other midi files, due to the addition of redundant tempo changes.

This would explain why some midi is act faster than others and why exporting a new score works just fine versus something like Ableton... In which case maybe has another functionality in that it doesn't need tempo changes back to the master tempo as long as some identifier is seen (of which I don't know because I can't reverse engineer any midi files myself) but I'm sure there is something there, given MIDI files from both will still play normally in things such as VLC and other music programs that support midi files.

Andrew-J-Larson avatar Oct 01 '22 23:10 Andrew-J-Larson