Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How can I set up gapless random looping with mutiple sounds?

Hi :) My question is one that I have searched for a few days now, and just cannot find the answer I want. I have a sound cue that has 3 interchangeable sound loops [background music]. The first solution I came across was to have a random loop node that calls the random node in my sound cue to get a random wave file to play, but it has a gap between loops as it says in the soundcue reference. So that does not work for me, I have also tried doing it in C++, checking for when the sound cue finishes playing, then picking a random node, and telling it to play that. This way also has a small gap between playing. I need a way to loop my background music, and when a segment (seperate wave player) finishes playing, to choose another segment, and have it immediately play that without any gap between segments. Either C++ or within the soundcue itself would be perfect.

Product Version: UE 4.14
more ▼

asked Jan 10 '17 at 06:18 PM in C++ Programming

avatar image

6 1 2 2

avatar image E1andri1 Jan 16 '17 at 03:22 PM

Hey, I've got the same problem right now. Either you have your files with a random node and a looping node behind (which results in a gap) or you set your files to be looping but then the random node is accessed only once, so you end up looping the same file over and over again.

How do you actually create random looping ambient sound cues?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

The Enveloper Node has indeed a Looping segment, but when I set the Loop Indefinitely flag, it stops looping at all, so either I'm using it wrong or it's a bug. Can you verify this on your end?

Maybe, if this node works, this is the solution to the seamless loop

more ▼

answered Jan 17 '17 at 12:08 PM

avatar image

96 6 10 17

avatar image parabreton08 Jan 19 '17 at 01:36 PM

Sorry, but I cannot get the enveloper node loop at all. I can't find any documentation or examples of how to get it to function in this way.

avatar image E1andri1 Jan 19 '17 at 01:40 PM

I just got it to work by specifying Loop Start and Loop End. Also I had to specify the Loop Count and check the Loop flag. If I check the Loop Indefinitely flag, however, it appears to be just a pass through node. So I assume, this is a bug. Maybe one of the staff members reads this. Also I have opened a forum thread about this, but without any response so far.

avatar image parabreton08 Jan 19 '17 at 02:25 PM

What did you specify loop start and end too? Is it beginning of song and end of song?

avatar image parabreton08 Jan 19 '17 at 02:29 PM

EDIT: When playing around with the loop controls, I cannot get the actual song to loop. Whatever I set the duration ends variable to, simply stops the audio playback alltogether. I'm starting to suspect that this looping fucntion is not meant for looping of the song itself.

avatar image E1andri1 Jan 19 '17 at 02:39 PM

I believe, we actually could utilize it for our purpose, if it worked at all, but right now, I guess, it's just broken. I've set it to loop the first 5 (so 0 - 5) seconds of a source file and I wanted it to be looped twice (it's indeed independent as long as you leave the loop indefinitely flag unchecked). That worked but for our purpose we need an infinite loop of the source and as it seems that flag isn't doing anyting but passing the signal through the node. I've read in another post that this node would do what we need, but I can't find the thread anymore. So, if we get the infinite loop to work somehow, that might be the solution to our problem

avatar image parabreton08 Jan 19 '17 at 03:07 PM

I can't get it to even loop 1 time, for any amount of the song. Loop start: 0.0 Loop End 1.0 Loop Count: 2 Only have the loop flag checked, and the loop indefinitely flag unchecked. When I play it it will play the first 2 seconds of the song, and the stop playback. If I change the loop count to 3, it will play for the first 3 seconds of the song, and then stop playback. There is no looping right now, it just plays for a duration of (loops start - loop end) * loop count.

avatar image E1andri1 Jan 19 '17 at 03:11 PM

mh, that's strange... maybe they recommended garbage in the other thread... A friend of mine recommended WWise, there are several free licence forms available... maybe an option for you, not for me, however, as my due date is tomorrow

avatar image E1andri1 Jan 20 '17 at 12:12 PM

WHAT IF we utilize a switch node and let a blueprint in an infinite loop decide which track to play?

avatar image E1andri1 Jan 20 '17 at 12:38 PM

Yes, seems to work... only barely noticable gaps between the tracks on my side seem to be caused by a not perfectly fitting seam... if you want, I can send you my blueprint. needs just little setup

avatar image parabreton08 Jan 20 '17 at 05:21 PM

Yea that would be good, especially if I can set it up in c++

avatar image E1andri1 Jan 20 '17 at 05:24 PM

You should be able to convert my blueprint easily into C++ code. Just write me a pm with your email on the forum, then I'll send you the uasset

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Has this been resolved? I have music clips that loop perfectly in Ableton, logic and Soundfirge as well as unreal but when I try to fire off a random succession of them they click at the start.

more ▼

answered Apr 16 '17 at 03:31 PM

avatar image


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi there! I managed to do something that works as expected but it requires you to know the BPM and time signature of your music:

SoundCue Blueprint

I needed to play different music "parts" on different situations but I wanted to randomize some of the layers so that the music isn't always the same (with or without violins or something like that).

The logic is like this:

  • First, you must set a Sound Cue with some random selectors and a switch for each "Part" and mix them as you like.

  • Important: each sample must be set to loop.

  • In the Blueprint, you calculate how long in seconds you want each sample to loop by diving 60 (one minute in seconds) by the music's BPM, then multiplying by the music's time signature (4/4 would be 4, 5/4 would be 5, etc...) and then by the number of bars you want to loop (a bar is the total number of beats in the time signature or the upper number - more here).

  • Make sure the Sound Cue is set in the Audio Component and set the switch's param initial value to 0.

  • Play the Audio Component.

  • Call the loop delay, update the "Part" parameter and play the Audio Component again with the new part set.

As far as I've tested, there are no gaps between each loop.

Hope this helps someone!


screenshot-9.png (462.7 kB)
screenshot-10.png (503.2 kB)
more ▼

answered Apr 23 '19 at 03:45 PM

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question