Unreal Engine 5 -> Problem with Sound Cue and Set Parameter Switch

I migrated my game done with Unreal Engine Early Access 2 to Unreal Engine 5.

I now have a major issue with the ‘‘Set integer parameter’’ using a Switch in a SoundCue.
I have a SoundCue that manages the music playing when I travel from a level/area to another. I used to set my ‘Level’ Parameter as an Integer in my ‘MASTER_MUSIC_SOUNDCUE’.
I used a switch in my soundcue to switch from one track to the other. Now that I migrated to Unreal Engine 5, the switch works BUT ONLY ONCE. Once I set my Integer parameter once, I cannot change it again.
The same issue is affecting my Stepping sounds for surfaces. When I set the Integer parameter in my soundcue to ‘Swimming sound’, it won’t switch back when I walk on the ground again.

I tried everything. It’s weird that I am able to change my Integer Parameter a first time when the switch is ‘Unset’ but I cannot switch it afterward.

Is anyone experiencing the same issue?

Thanks for your support.

1 Like

Hey @Magoo7 !

I had the same problem, and I also have been trying everything to fix it (started at 11:40pm thinking it would be an easy thing to fix but now is 3:12am :upside_down_face: )

I’m glad to tell you I found a workaround! For now, I’ll call it a workaround because the old way should be able to work unless I may be misunderstanding how the audio system works, which could be possible because I haven’t researched it as much as I would like.

The same issue is affecting my Stepping sounds for surfaces. When I set the Integer parameter in my soundcue to ‘Swimming sound’, it won’t switch back when I walk on the ground again.

So the code that used to work for me is this one. Which played different footstep sounds depending on the surface. That FootstepComponentRef is an Audio Component inside my character, where I can change that Integer value to update the type of sound that should be played

Looking around the audio component inside my character, I found this little category, that I don’t remember if I saw it before or not, called Default Parameter. I didn’t know if it worked correctly, so to test it I added my parameter name and value and decided to disconnect all the code the changed the parameter value.


This little change seemed to work, and if I manually changed the value before playing in the editor, the sound seemed to change.

Now, thinking logically, if it’s an array I can probably change the value in runtime and maybe UE5 will like this new approach, so I changed my previous code to this:

And this way of changing the value worked!

Hopefully I managed to explain myself well before passing out, but do let me know if this worked for you or if you found another solution.

Kind regards,
Ram

7 Likes

Duuude !!!
You’re my hero! :heart_eyes: :star_struck: :heart_eyes: :star_struck:
Thank you so much for your fast and full fledged answer!!! It all seems to work now.
I’ve also been playing with the new ‘Default Parameters’ section but didn’t managed to make it work.
I find it odd that we have to use this workaround. We now need to define the name as well as the index of the parameter to change it when we used to only need a ‘name’ to find the parameter. I hope Unreal will provide documentation to explain why it works that way now… or fix it the old way of doing things :stuck_out_tongue:

Nevertheless, thank you very much! And great work for finding a solution to this issue! I spent a lot of time too trying to figure it out xD

Glad it helped!

I hope Unreal will provide documentation to explain why it works that way now… or fix it the old way of doing things :stuck_out_tongue:

I guess it’s time to learn Metasounds :grin:

1 Like

Hmm i have the same problem, right now I’m changing a boolean parameter while the sound cue is already playing. That worked until I upgraded yesterday and sadly your solution doesn’t work for me. It’s not changing while already playing. I can change it manually before starting but not in play. I hope the old way of doing this will be fixed soon.

Same thing here. I can not set audio parameters or update it in real time. If anything else, you could use a switch case and point each case to a separate sound cue that doesn’t take any parameters. But more work. I hope this gets fixed and not ignored.

Same over here. I had a vehicle with the engine sound modified in real time by the engine RPM, through a float sound parameter. In tthe UE5 preview version worked well, after the update it doesn’t work.
This doesn’t work neither in the Vehicle template project, where the blue buggy always sound like it’s iddling despite the RPM or speed.

yeah that would be a way, but i think that would also kind of defeat the purpose of a sound cue :frowning:

I also found out.
My current code from 4.27 with SoundCues are working, but only if the sound is not allready playing.

Changing a Parameter during runtime, like an Engine RPM does not work.

@Ramboozled’s solution worked for me as well, but for my situation I also had to add a short delay and reset the parameters after it played for some reason. Just wanted to add this note

I was able to update the Parameters while the sound is playing using the new MetaSounds.

If you want to change the current playing sound wave you have trigger the update in your code:
MetaSound with the Sound Wave Inputs

In Blueprint:

Updating the float parameters seams to be working without an additonal trigger

Good to know that you can achieve the same result with MetaSound :+1:

Looks like Epic has an issue tracking this slated to be fixed in 5.0.2.

Discovered in this reddit post: https://www.reddit.com/r/unrealengine/comments/u85q3b/set_float_parameter_for_sound_cue_not_working_on/

1 Like

One more thing to note about the workaround is that you can only change the default parameters and have them take effect if the sound isn’t already playing so this unfortunately doesn’t play well with a more dynamic sound like an engine sound and an RPM parameter.

It sounds pretty bad still because of the constant cut out but I used this logic to at least get some better sound while I wait for a fix :

    //...
    const FName RPMName(TEXT("RPM"));
    // ...
	float Rpm = Movement->GetEngineRotationSpeed();

	UE_LOG(LogGameVehicle, VeryVerbose, TEXT("%s: Setting Engine Sound %s to %f"), *GetName(), *RPMName.ToString(), Rpm);

	// FIXME: Due to https://forums.unrealengine.com/t/unreal-engine-5-problem-with-sound-cue-and-set-parameter-switch/514798/2
	// To be fixed in UE5.0.2 - below is a workaround for 
	// tracked in https://issues.unrealengine.com/issue/UE-148618

	// EngineSounds->SetFloatParameter(RPMName, Rpm);

	int32 RpmParameterIndex = FindRPMDefaultParameter();
	check(RpmParameterIndex != INDEX_NONE);

	float CurrentTime = GetWorld()->GetTimeSeconds();
	if (CurrentTime - LastSoundUpdateTime >= 0.25f && FMath::Abs(Rpm - LastRpm) >= 1000.0f)
	{
		EngineSounds->Stop();
		EngineSounds->DefaultParameters[RpmParameterIndex] = FAudioParameter{ RPMName, Rpm };
		LastSoundUpdateTime = CurrentTime;
		LastRpm = Rpm;
        EngineSounds->Play();
	}

A simple workaround for this would be to reset the audio parameters before setting them:

2 Likes

Confirmed that this is no longer an issue in UE 5.0.2. I took out my hacks and now it works as it did in UE 4.

I am working on 4.27 Plus and it is not working but adding the audio component inside my Blueprint worked. Interesting that this is working on regular launcher 4.27