Getting BPM after song change returns previous song's BPM

I have two songs: song 1 with rackspace 1 and song 2 with rackspace 2.
Song 1 has an overridden BPM of 80 BPM, the second 120 BPM

When I use a script to print the BPM after a song change using the following script:

    Function PrintBpm()
       var bpm : double = GetBPM()
       Print(bpm)
    End
    
    On Song(old : integer, new : integer)
       PrintBpm()
    End

I see the BPM of the previous song, not the new song.
Is this because the song BPM/properties are processed AFTER this callback is called?
How can I get the BPM of the just selected song?

Problem solved: I can use the On Rackspace callback.
However, still I would have expect the On Song would return the just selected song BPM :slight_smile:

I came across this issue as well. My ‘solution’ was to add a brief pause after the callback( in the form of the Sleep function) but before the action. Even a 5ms delay was sufficient for the new song BPM to be recognized and for the variable to return the proper value.

I do agree it would be expected that the newly selected song would have its BPM returned, not the previous song.

1 Like

Hello edm11 … sorry for my late answer …

Thanks for that alternative approach … for now it works with the way I have implemented it, but good to know there is a solution.

1 Like

Why can’t you use GetSongBPM() ?

Thanks, I wasn’t aware there were two functions for getting BPM.

It’s well documented in our system function list. And there are three functions - rackspaces can have a BPM as well

1 Like

I just checked and (of course) you are right … probably I stopped looking further after finding the first function.

1 Like