Log In  


Hello!
How to change the current music pattern, while maintaining tempo?

In my game, I have my music looping pattern 0,1,2. When an enemy enters the map, I would like the pattern 4 to play, without loosing tempo. Ideally, the pattern change would happen on bar.

I have succeeded using function stat(407) to read the last track of my pattern and detect the beats. However, when I call music(4) inside _update() to switch the current music, the transition happens too late, and I hear shortly the beginning of the next bar of the current music, and then first note of the new music. In short, when stat(407) returns 1, it is too late to schedule a music change.

I would need a hook or callback in the music sync code to peek the timing, and post the music change exactly at the right moment to have smooth transitions. How to do that?

Thanks!



Maybe you could move the check one note earlier and then set a timer for just under the duration of the note?



[Please log in to post a comment]