Audio Cue: Start Loop at Random Point

Hello,

I’ve searched around and can’t seem to find an answer to this.

I would like to start playing a sound (which is looped) at a random time within the audio file. Essentially, I have a nice looping machine gun sound, but if you burst fire, you always hear the first segment of the loop. If I could get it to start play at random times, it wouldn’t sound as repetitive. I already have a ‘start’ sound to cover up the start of the loop sound.

Is there any way to do this within the sound cue? Here is my current cue.

a10b592b4c650aca6ba4995cbb5d512e0ee21052.jpeg

Thanks!

If I understand correctly you want to use one sound to play randomly. That’s when you add in a “random” node. Such as this as an example…

And what you could do like it shows is add a delay and at different times. And what happens is that the random node will randomly select (obviously) which sound to play after the delay time. But I would advise to duplicate the gun loop. I’m not sure if doing it the way it shows will work, I didn’t test it. I just put it together so you could see what to use. I hope this is what you needed and helps.

Thanks for the response.

This was the first thing I considered, but because the gun loop is about 4 seconds long, I didn’t want to have more than one copy in memory, which is the only way I’d be able to do it. Using delays would slightly off-set where the loop sound came in, but not enough to keep burst-firing from sounding repetitive.

Here is a video demonstrating the problem:

I’m going to experiment with triggering the start and looping sounds within the blueprint instead of a cue, as I think I saw an option to chose how far into the clip to start. I’ll report back with any results.

I know this is an old post but here’s the answer in case anyone’s still looking.

Make sure your sound cue component is NOT set to “Auto-activate,” then use something like this to pick a random start time and call the “play” node in Blueprints.

NOTES:

  • If you have a looping sound and want to get the duration to pick a random start time, you’ll need to add a variable reference to the original, non-looping sound wave file, NOT the looping sound cue used in your audio component. You see this in the image below… looping sound cues will just return a default duration of 10000.
  • I did this from the level blueprint, but I assume making your sound actor into a blueprint or attaching it to a blueprint actor and doing it directly in there would work just as well.

I have kind of the opposite issue. I need a sound to be looped, but triggered randomly using a delay… the problem is the sound starts sometimes mid point because of the looping. How could I set it up so it always start the sound from the start? Sorry for doing this on your post, but I can seem to find the answer anywhere.

Would be awesome to see such feature in cue editor