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"

How do I make skippable music tracks?

Hi folks,

I'm trying to think of a way that I can play audio music tracks in a skippable way. For example I want to have 5 tracks that play from 1 to 5 in order, but I'd like the player to be able to press a key to move to the next track with the audio fading out and also to be able to go back to the previous tracks by pressing another key.

I've played around in Blueprints but haven't had much luck with stopping the tracks and going backwards on pkey press.

Any ideas would be appreciated.

Product Version: UE 4.15
more ▼

asked Sep 28 '17 at 12:36 PM in Blueprint Scripting

avatar image

54 3 8 14

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

1 answer: sort voted first

Hi there. I had a bit of a play around with this in UE 4.17, testing with several tracks. Please note this probably isn't the most elegant solution, however it seems to work as a basic premise. I created this based on the First person shooter blueprint template.

1) I created an actor to place in the level which I named MusicPlayer (Totally original I know). This actor has a public array of SoundWave assets that can be added to. It also has two public floats: Fade In Time and Fade Out Time. These denote how long it takes to fade in and fade out between music tracks respectively. There is also a private integer (named Music Pointer) which I use to keep track of which soundwave asset should be playing. The actor has an Audio component which allows for the Soundwave assets to be played. alt text

2) The MusicPlayer actor has 3 main functions; Play Music, which is intended for when the music begins initially. It tells the Audio component to set a Soundwave to play and then tells the Audio component to play the Soundwave.

alt text Go To Next Song fades out the song that is currently playing (The fade goes for the duration denoted in Fade Out Time). While the Audio component is performing the fade out, a delay is set for the duration of Fade Out Time. Once the delay is complete, the music pointer is incremented, another soundwave selected and the soundwave is then faded in (It fades in based on Fade In Time). alt text

The Go To Previous Song function essentially does the same thing, just selecting the previous song as opposed to the next one. alt text

The Set Music Pointer function is just ensuring that the music pointer doesn't go outside an expected range so can always select a sound from the Music To Play array. alt text

To use this blueprint, you can place it into the level you're building and just add in soundwaves. To interact with this object, I use a Player Controller as a messenger between the MusicPlayer actor and a UI. If you want to use keys to go between songs, you can set up an action mapping in the Input section of the Project Settings (Edit > Project Settings... > Input). You could then use your player controller to implement those action mappings and have it talk to the MusicPlayer to tell it to go to the next song or go back to a previous song (In my project, I created two input action mappings: Next Song and Previous Song then implemented them in the player controller. They then call the respective functions of the MusicPlayer.)

One last note on the functions; using the begin play event, I set a reference to the MusicPlayer for the player controller to use. This allows for the MusicPlayer functions to be utilised.

If you would like to see my basic implementation, I've placed it up on github (https://github.com/RLangridge/AnswerProject).

more ▼

answered Sep 29 '17 at 12:39 AM

avatar image

18 3 5

avatar image Bushey Oct 03 '17 at 08:08 AM

Hi Hightype,

Thanks for your answer!

I'll take a look and see if I can get it to work in my project.

I tried following your Github link but the link seems dead though.

I'll let you know how I get on with your Blueprint.

Many thanks,


avatar image Bushey Oct 07 '17 at 07:06 PM

I've made the array, which is an actor array (is that correct) I can't add any of my music to the array, and I can't get to link to the the sound. It gives this error (array of actor references is not compatible with sound base reference).

avatar image Hightype Oct 11 '17 at 10:10 PM

Hi Paul,

Sorry that I hadn't responded earlier. I think I may have grabbed a space in the link: hopefully this one should work: https://github.com/RLangridge/AnswerProject The array that you will want to make is an array of SoundWave objects. In my example above, the Music To Play array is an array of SoundWave objects. From there you should be able to add in music. Please let me know if you need more assistance or if my link still isn't working.

avatar image Bushey Oct 12 '17 at 01:28 PM

Hi HighType,

Thanks for replying again. I've managed to download your link and I'll hopefully be trying it later today.

Many thanks,


avatar image Mouniryssf Sep 30 '18 at 12:33 PM

Hello, Just a quick question... Can i then display on a Widget the name of the song that is playing? If so then how?

(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