cifkao / html-midi-player

🎹 Play and display MIDI files on the web
https://cifkao.github.io/html-midi-player/
BSD 2-Clause "Simplified" License
663 stars 60 forks source link

Tempo control #21

Open cifkao opened 3 years ago

cifkao commented 3 years ago

Add a way to control the tempo. This should be optional – possibly turned on with an attribute, maybe controls="tempo" (which might just reveal the control with CSS).

It's not clear what kind of control to use, an easy one would be <input type="number">.

The functionality itself is present in Magenta.js, we just need to call BasePlayer.setTempo(qpm) at the beginning of playback. However, this feature has some bugs apparently related to the fact that the Magenta.js player doesn't account for tempo when it sets durations:

fredgreen182 commented 2 years ago

Are there any plans to develop this enhancement?

cifkao commented 2 years ago

Personally I'm not planning to implement this, given the fact that even if I figure out the UI part, there are unfortunately the limitations that I described. Solving these limitations would require either relatively heavy changes to Magenta.js, or dropping Magenta.js and switching to a different backend. However, I'm happy to accept contributions on the UI side and I can then help implementing the interaction, keeping in mind that it would be an experimental feature due to these limitations.

PerryRylance commented 7 months ago

You might find midi-to-milliseconds useful