How to use Crossfade

Good Morning! i have searched the forums, and youtube and google for days lol and for whatever reason i cant find an answer and im going a little nuts :D. What im tryign to do, is use a crossfade with different types of music, that will change throughout the day, and which i can also call in other blueprints, to change ( combat, entering a town etc) but i can not figure out how to use a sound cue i made with a crossfade node. i only have 2 tracks currently. Any help would be GREATLY appreciated. Thanks for your time :slight_smile:

Hey @Nate1232!

Are you using Crossfade by Param? If so, check out this non-Epic affiliated video with an example on how to put it all together:

I hope the above is the solution you need!

1 Like

hey buddy, thank you so much for replying to my question…i think im an idiot lol…i still dont get it :smiley: i just want the music to change ( when once song finishes, the next starts) i have absolutely no problem setting a different song manually depending on the time of day…but i cant get the dam crossfade to work :smiley: :smiley:

Hey @Nate1232,

Okay, so I understand which part exactly, is it specifically the fading portion you are having problem with or the automatically changing portion, or both? Or maybe it’s something else and I am misunderstanding the problem. Also, would you mind sharing your parameters set for your crossfade node so we can see what you have so far?

1 Like

I was typing out this long message and thought i would just attach some photos :smiley: all im trying to do (just to get it to work) is have my first song play between 9am and 12pm, otherwise, play the other song


Hey @Nate1232!

So a few things I see here:

  • Event begin play is called only once at the beginning of the game so it will not continuously check the time like you are wanting. You will want to check the time using a node that continuously checks the time (event tick or something similar) and call your wanted custom event when float enters range and exit range.
  • Between your branch and your “set float parameter” nodes, you are going to want to use a timeline and a lerp node to adjust the float between 0 and 1 to get your crossfade effect.

I hope the above is the solution you need

1 Like

Thanks man!! :slight_smile:

Hey @Nate1232!

Checking in here. Did the above solve your issue with getting your crossfade working?

1 Like

hey! no, i couldnt get it to work…i think im an idiot lol, and i didnt want to bother you with it again buddy

Hey @Nate1232!

Don’t sweat it! Post what you have so far again and we will take another crack at it! I think your best bet, though, is to try and set it up with a box trigger to see if that works and we can modify from there if it does! If that does not work we can work backwards from there.

1 Like

i deleted the little bit of code in my music manager actor cos i was getting annoyed lol. i can kinda of comprehend what needs to be done, i just cant put it into practise. im using ultra dynamic sky, and have made a daytime and nightime sound cue with crossfade. there are events i can call for sunrise, sunset, noon, and hourly. My problem, is i just cant get the crossfade to take effect…its drivnig me nuts lol…also…while i have you here, if you dont mind mate…recently i keep getting this error tryign to save my game after a while ’ Unable to overwrite existing package /Game/Maps/MyRPG’ and if i create a new save, and try and save the next time, i get the same error but replace myrpg with my new name. any ideas? thanks so much for your time dude :slight_smile:

Hey @Nate1232!

Okay, then let’s start at the beginning, since it will be easier that way. Let’s take a look at your sound cue where you set up your fading. This portion here if you don’t mind sharing a screenshot:

As far as the saving question goes, it would be best to start a new thread so that way it gets more visibility and when there is a solution for it, it can be solved and others who are having the same problem can find your thread for answers!

thanks dude :slight_smile:

It’s no problem @Nate1232!

Okay, so using your parameters I have a mock up for a working test. This just uses a simple trigger box to change the sound. You will need to create a new actor blueprint, add your trigger box and sound cue to the actor as you have done with your other blueprints, then use the code below. In theory it should work and we can work from there, or it will give us a better idea for what’s going wrong!

that works fine, although, when i enter the triggerbox the song instantly changes its doesnt fade out and in ( not sure if thats supposed to happen but thought i woudl mention it ) thanks again for your help man

i would at some point like to maybe promote the song type or something to a variable so i can change it during combat and stuff from my enemies :). anywho, thanks for helping man, i look forward to the next step :slight_smile:

Hey @Nate1232,

That’s great, we are making progress! So now let’s tackle that instant change next. What you need to do is set up a timeline and a lerp node between your trigger and your Set Float Parameter node. They won’t be able to fully connect just yet, but you are going to want to set A of your lerp to 0.0 and B to 1.0, then connect your pins to play and update like so:

From there, open up your timeline (double click it) and add a float track. You can set your float track to whatever length (in seconds) you want for the blend. No matter what length you choose, you are going to need to set two pins, one at the beginning of your track set to 0 (0,0), and one at the end of your track set to 1 (x,1). From there you will be able to connect that new track output to your Lerp Alpha.

Once this is done and we got it working for you we can tackle your events and the groundwork for you should be all set!

holy crap its working lol…ok im ready for the next step :smiley: thanks so much man, now that im looking at it, im not sure why it wasnt clicking foe me initially…oof :smiley:

Home stretch @Nate1232!

From here you are going to want to create a custom event for your audio change that another blueprint. I created another trigger like we did before, except this time, I removed the trigger event from the original, and the new trigger placed elsewhere in the level can change the audio now instead. This is a beneficial method that will come in handy when you day and night cycles call their events. Remember, you will need to use the Get Actor of Class to cast to your sound blueprint successfully.

I hope the above is the solution you need!

1 Like

thanks so much man :slight_smile: i truly appreciate it :slight_smile: