I created my own XM music player library some time ago. It was pretty easy for me to add something like an event listener to it.
The player emits the Note events every time it’s about to play a note. That Note event includes the note value (an XM note value), its volume, channel, and some other info.
It would also be possible to change the BPM on the fly and add dynamic speed changes to the game, but I ran out of time.
Here is the library itself: https://github.com/quasilyte/xm