Music looping to specific point

So my game features music tracks that loop, but not to the very beginning. Instead to a specific point in a song. Like for example, a song that I play might restart back at the 5 second mark at around 120 second mark, just before the end of the sound file. Basically, playing the song’s intro only once, and stopping before the ending plays without having to chop up the sound file into multiple smaller files.

In Blueprints, I have it set on a timer that loops every 0.01 seconds, and increments a float value by 0.01 which I’m calling “Overworld Music Time”. I also have a data table that contains float values for the loop back point of every song as well as what point in the song it should loop from. So when “Overworld Music Time” reaches the specified point in the song, it stops the audio file, and plays it again from the loop point. This works just fine except for one thing.

The problem is that “Overworld Music Time” does not increment when the game is paused. To my understanding, timers don’t run when the game is paused, but what might an alternative solution be? I could get around this entirely by just stopping the music when the game is paused, but I don’t want to have to do that.

What’s a good way to get timers to run while the game is paused? Or better yet, does UE4 have any built-in system of this sort of music looping that I’ve somehow missed?

Never mind. I figured it out. What I ended up doing was checking “Tick even when paused” and rather than a timer handler, I just connected the node back on itself with a delay.

1 Like

Hi KrayfishKarl,
your blueprint sounds amazing. I’m learning unreal and was hoping you could help with a basic game music question. Here goes: How can I set up my game music to speed up OR set it to play a sped up version of the game music when the game countdown is low?

1 Like

THAT WORKED!!! thank you so much!

Thanks! And glad you were able to figure it out! I had no idea this thread was still around five years later, but I’m glad it was useful!

As NickNickNicktom said, the pitch multiplier node should take care of everything you need.