Randomized wait time before looping.

Hey,

I’m working with a simple music track for a small game. I can easily figure out how to loop it, but what I want to incorporate is a pause, silence, or delay, before restarting the loop and I want the amount of time to be random (50-80 seconds?).

I’m still learning FMOD Studio and I’m stumped as to how to do this. I’m sure it’s simple and I’m over looking something.

Thanks!

Hi Harry,

If you’re looking for a way to do this within Studio, you can use a Tempo Marker & Marker with a Transition Region & a Transition Marker. Place a Tempo Marker on your Event to match your music, with a Marker at the beginning. Place a Transition Region 50 seconds after your music has finished that lasts 30 seconds, setting the destination to your Marker and Quantization to anything you wish. Turn on the Probability condition and set it to around 10%. This will give each transfer point a 10% chance of looping back to the beginning. Place a Transition Marker at the very end of the Transition Region to catch the cursor should it reach the 80 second mark without transitioning.

Please see the below screenshot for an example.

An alternate way is you can place your music into a Scatter Sound and set the Min/Max Scatter Distance to 0, Polyphony to 1, and the Interval Between Sounds to however long your music length is plus 50~80 seconds. In order to get this method to work right, the Scatter Sound needs to be placed on a track in a Game Parameter tab.

However, it will probably be better to use scripting in whichever game engine you’re using to add a random amount of wait time before looping again.

2 Likes

Thank you Richard. Your first idea is fantastic, and makes sense to me. I did find a work around, yesterday.

At the end of my music track length I created a few Transition To markers - one to a place that lasted 50 seconds, another 60 seconds, etc. Each of the Transition To markers are stacked on top of one another and have about a 40% chance to play. I’m not sure how FMOD handles this logic but it seems to be relatively random. Sometimes it’ll by pass all Transition To flags without triggering so I created another milliseconds later that has a 100% chance to go to 50 second wait time.

Overall, I like your method way better. Thank you.

1 Like

When you have multiple transition markers at the same timeline position, they’re evaluated from top to bottom in the order they’re displayed on the logic track. This means that you could move your 100% flag to the bottom of the stack if you wanted, and it’d still work as intended.

1 Like