I am still new to using metasounds with UE5.1, I had this Sound Cue set up for a engine sound. It has 2 sound assets mixed together: An Engine start sound, and after a delay an engine loop starts playing and is looped so it plays forever, till the audio component holding the sound cue is destroyed. The sound cue is setup with attenuation that attenuates audio with distance till it becomes inaudible.
With the old sound cue system when I went outside the attenuation range and then back again, I hear the looping sound playing and I don’t hear the engine start sound being played again. I tried setting up a metasound source to do the same thing, deleted the One Shot interface so it runs forever.
The problem with the metasound source is when I go out of the attenuation region and back into it again, the metasound starts from the beginning, playing the engine start sound again and then the loop sound afterwards.
The virtualization Mode was set to “Restart”, tried setting the virtualization mode to be “Play while Silent” and it fixed the issue, but don’t know if it will have any bad impact on performance, especially that the sound cue worked as expected while set to “Restart”
Any suggestions on how to fix this issue?
Itll require some different thinking to handle.
In that, the Metasound system behaves differently than the old Sound Cue system in terms of audio virtualization. “Virtualization Mode” is a setting that determines how the engine should behave when there are more sounds playing than the maximum allowed by the audio engine, or when the sound is out of range (like in your case).
The “Restart” mode makes it so when a sound becomes virtualized (i.e., paused or stopped because it’s out of range or too many sounds are playing), and then de-virtualizes (i.e., resumes playing because it’s back in range or there’s room for more sounds), the sound restarts from the beginning. This is why you’re hearing the engine start sound again when you come back into range.
When you switch the virtualization mode to “Play While Silent”, it essentially keeps the sound playing in the background even though it’s virtualized, and just mutes the audio output. So, when you come back into range, the sound is still playing where it left off (which is why you only hear the looping sound).
As for performance, this impact might not be significant unless you’re running into the limit of simultaneously playing sounds frequently.
If you need the behavior of the “Restart” mode for performance reasons, but want to avoid hearing the engine start sound when re-entering the range, a possible solution could be to split the engine start sound and the looping sound into separate Metasound sources, and control their playback separately. You could trigger the engine start sound only when the engine actually starts, and use the looping sound with the “Restart” virtualization mode to simulate the engine running. This would also give you more flexibility to control the engine sounds.
Remember that this would require more control from the gameplay code, and you may need to handle the logic to avoid playing the start sound again when you are not supposed to (like when coming back into range).
This approach should give you a similar behavior to what you had with Sound Cue, while still maintaining better control over CPU usage than the “Play While Silent” mode.
Thank you for your reply, and it has been really informative and helped me a lot think better about how to approach this problem.
The problem that me think of switching to Metasounds (Sound cues support all the functionality I need and did everything I needed to do) was cause there is a bug or loading behavior problem with soundcues, that sound is played with a delay the first few times, then it plays properly all the time afterwards(Probably the sounds are being cached to memory, thus they don’t need to be loaded from disk and no loading delay is present).
I was able to solve this problem by changing the loading behavior of sound assets used to “Force Inline”, but this option increases both memory and disk usage, which won’t be super optimized for my case. Switching to Metasounds solved this issue totally , and no delay was noticed at all, but then I found the Metasounds pretty limited as there are many nodes I use regularly which I can’t find a replacement for in Metasounds, such as “Attenuation” Node, “Sound Node Local Player” node, and then this restarting problem.
But I will try to look more into Metasounds and see if those nodes could be replicated, or if you have a suggestion on how to solve the delay problem with Sound cues, any help will be greatly appreciated.
Thank you once again for your reply.
bumping