How can I resume an out of range sound when the player comes back

Hi all,
I have an AmbientSound actor in my scene, being attenuated and playing a 10 minutes sound.
When the player comes in the sound zone, it starts as expected. When he leaves it stops, that’s fine.
But when the player comes back, the sound restart from the beginning !

I’d like to keep the sound “playing” (but silently), so that when the player is back, it sounds like it continued playing on his own (just like it would in real life).

How can I do that ?

Thanks
Guillaume

1 Like

It isn’t ideal but I think that the only way to achieve this currently would be to set your sound to ‘Always Play’ via its Sound Class. This will ensure that the sound won’t actually stop if it becomes inaudible. This does use up an extra channel for a sound that you won’t be able to hear though.

We don’t currently have a system that allows us to make sounds virtual, so that only their current time is advanced. You could perhaps set up a system to do that yourself, by getting the current time of the sound as you stop it and when you start the sound again set the Start Time to begin part way through the sound.

“Always Play” works fine, thanks a lot !

Is there a hard limit on the channels number ? Or is it just about overall performance ?

There is a MaxChannels value that can be set in your engine config ini, which defaults to 32. It should only ever really be a problem if you set a lot of sounds to always play at once, which would force other sounds you might expect to hear to not play.

For noobs like myself. Can you expound about how to do this? How do I access this setting?

Sound Classes are assets that you can set on any sound, there are some default ones that come with the engine but you will have to enable the ‘Show Engine Content’ switch in the Content Browser View Options for them to show up. For example if you wanted to ensure that sounds tagged with the default voice Sound Class always play, open the asset and change this value:

Then open your sound and change its Sound Class to Voice:

Is the maximum of 32 channels restricted across different levels? In other words - using this method, if there are a large amount of concurrent sounds playing in different streaming levels will all of them be included in the maximum 32 channels?

Yes, all playing sounds will contribute towards the maximum channel count, no matter which level is playing them.

“Always Play” has a bug in 4.13

Instead of resuming just re-launch the sound once the player is at a certain distance.
You can also possibly write a small functionality that save the time the sound stopped playing and the current play position, then when the player is near enough it will take the current time, subtract the saved time, and figure out at what position to play the sound again.

1 Like

Ofc, we can do some bad techniques to do the same things, like use a very big FalloffDistance and use a custom curve for distanceAlgo.

But cj.allen321 gives the true answer here :

1 Like

his solution might be valid, but that does not men my technique is bad, it’s a cheap workaround, you just stop and sound and play it again when in range

Theres a fix now apparently.
Open the sound, go to the Sound tab and activate Virtualize when Silent
Worked for me.

2 Likes

I can’t find this in version 4.20.2

Bit late on this but I was looking a similar thing. As far as I can tell, it’s now under Voice Management; Virtualization Mode.