Randomized Loops

UE4 … I had a clue how to do this and made a procedural music generator. I can make it work with sound cues.

With UE5 and metasounds, I am so lost and can’t even get the arrays to properly play.

I’ve followed a few tutorials, and those also aren’t providing results. So if you are able to help me trouble shoot, from scratch, it’d be appreciated.

My goal is to create a procedural music generator using different layers. Bass, Percussion, Chords - these are pre-recorded wavs, and edited to seamlessly layer with each other.


The bass plays and loops, yet there is no switching between the different loops. It picks one file and loops it.


This doesn’t even work, and as far as I can tell, it should.

It appears there are variables with delayed get for loop detection, and I can’t find an actual tutorial on how to make it happen. The blueprints I’ve seen are great, yet there are some steps in how to get from A to FINISH that I’m not understanding.

Is anyone willing to help me figure this out?

This is the documentation I followed : How to Use MetaSound Presets | Tutorial

It turns out, in my blueprint that the ‘bass drum’ is the preset, and it isn’t playing. When I make it an array, it does play.

The first blueprint is the bass drum preset, and it plays, loops, but doesn’t randomize. I’d like to have it play a random number of times before switching.

1 Like

This post should help you:

You need to retrigger the random get by using a delayed get node like in the graph shared in the post I linked.

It’s a great blueprint and I’m sure if the details that are revealed in it were to be explained, I’d have my answer. However, the blueprint by itself doesn’t help b/c of the lack of details and how to get there. I do thank you for your effort though. :slight_smile:

Okay—the reason it is only looping one of your bass drum assets is because you are only triggering the Random Get once. The Random Get is picking a random bass drum and the Wave Player is looping that one asset.

Here is one way you could set this up.

You need to generate two random integers—one to use as a seed for selecting a random wave asset, and one to determine the number of times to play before switching.

On Play, you generate the random integers, select a wave asset, and play the wave asset. Then you count the number of times it has played. If the number of times it has played is less than the random number of times to play before switching, then loop the same wave asset again. If it is greater than or equal to the number of times to play before switching, then reroll the random integers and reset the Trigger Counter.

2 Likes

Most excellent, thank you so much! I’ll try this out.

I’ve posted the graph as a snippet.

You’ll need to set up the variables but it should make it easier to copy/paste.

2 Likes

Ebuch, thank you! This worked! Your input is greatly appreciated!

1 Like

Very glad to hear that—best of luck with your project!

1 Like