Set audio track "elapsed-time" as a variable?

I’m in Sugarcube 2.31.1.

I’m starting to work through the audio side of the build. Because the timing of the experience is user-defined, I’m working with a musician to build the music from short loops. However, in order for everything to stay in tempo, we would ideally be able to control to precise moment when one loop ends before another one begins.

For example, imagine we have two loops, one in single time and one in double time.
After a user-defined period of time* on the passage, I want the music to go into double time, on the beat. There are precise timings in the loop where this happens—the bar breaks, essentially. Is there a way to code:

"At $30wps, stop the first loop and play the second loop but wait until the first loop is at 4 seconds or 8 seconds before playing the second one and stopping the first.

Would some version of the if command work in this scenario where the audio track time is a variable?

Many thanks, Ben

*their reading speed defined by words/second, as the variable $wps, the subject of this thread.