Random BGM that loops like a playlist

I’m trying to make a menu that loops random songs and when it is done playing one song, it randomly selects another song and the playlist loops. Think Shuffle + Repeat all. I’ve tried to do this in a sound cue but I don’t think that is the way to go.

Any help is greatly appreciated!

Thanks!

There is no music player, you need to make one with blueprints. Make blueprint with audio component and from there you can build logic, start the music on BeginPlay and on audio finished event of audio component do a music switch logic whatever you like it to make. Shuffle+ReapeatAll you could achive by making array of all songs and then shuffle that array. I recommand you to leave array empty in blueprint and set the array on the level it self in property menu, so you can easily reuse this music player.

Put the music player on you menu level, set up playlist array and you ready to go

Hey there! Thanks for the reply!

I’m still confused. I’m not sure how to make this happen? I can load everything up to select a random song to play, but I can’t make it select another random song after. It just stops playing. How do I make it wait until one song is done playing and then play the next song in the array?

I tried to upload my blueprints before but for whatever reason the post didn’t post.

Can you maybe help walk me through how to achieve this?

To be clear, I don’t want the player to have control over the music I just want it to play a random song, then once that song is over, play another random song and never reach the end of the playlist (array) and just loop the playlist.

Thanks!
Neil

I know this is an old thread, but if someone is still looking for an easy way to do this, you can try this in a sound cue and then just play it from somewhere, it will randomly select from the list of your songs at the beginning (just add more “random” nodes for your songs) and loop the whole thing idefinitely:

5 Likes

Hey man, just to say thanks, was looking on how to achieve persistent looping of several music files, and you made that quite easy. Cheers :smiley:

Just stumbled across this and nabbed it for use on a game Menu. One slightly odd thing though, I have a text box for a server IP address on the menu and when you click in that it changes the track - a bit odd, but it’ll do me for now!! Cheers OP!