Download

Sound System: Delay playing a sound based on actor distance

This may be a bit of an unusual request, but I was wondering if it would be possible to add a feature to the sound system, where an event happens in the distance and the sound gets played later due to the sound having to travel through air at the speed of sound? For example, a lightning bolt strikes the ground off in the distance and there are multiple players which observe the lightning bolt. Each player is a different distance from the impact point, so the time at which they hear the thunder is a function of their distance from the impact point (~5 second delay per mile). One player might hear it instantly while another might hear it 5 seconds later.

I think if you wanted to get super technical, you could design the system such that the speed of sound is dependent on the density of the medium it is travelling through.

So, no sound in empty space due to no medium;
340.29 m / s at sea level through air medium
1482 m/s through water medium
5790 m/s through steel medium

(ref: Sound Speeds through Solids)

I imagine attenuation settings would also be affected by the medium through which sound travels through :open_mouth:

AFAIK, there isn’t really many ways for sound to semi-realistically travel through mediums, hence the reason that 9/10 games have sound that goes through everything (I’m mainly concerned about performance). It would be a bit strange if you had a wall with 3 different mediums, and you heard the sound 3 different times due to the time it takes to travel, don’t you think? I am curious though as to what could be achieved with this in mind.

You could set this up yourself relatively easily by getting the distance to the player and then delay playing the sound by a certain amount as a function of that. Maybe create some kind of “sound manager” class that handles playing your sounds and then pass events to it from any actors in your scene that need to produce sounds.

Hyperloop, if you can catch all those events of play (as with a keylogger that can interfere all keystrockes) then you could calculate this if you can pinpoint the location of the event (position transform) and the location of the player, so in a queue of we must play this sounds… you can achieve that… also it can have a sound level…

so we will need to subclass sound manager???

As I see here https://docs.unrealengine.com/latest/INT/Engine/Audio/Overview/index.html?utm_source=editor&utm_medium=search&utm_campaign=user_initiated there is a initial delay in the sound mix and classses there only exist this ones that say sound???

https://docs.unrealengine.com/latest/INT/API/Editor/SoundClassEditor/index.html
https://docs.unrealengine.com/latest/INT/API/Editor/SoundCueEditor/index.html

you’re overthinking it. In your case delay could be will be calculated based on the shortest path from point A to point B. Or it could be based on straight line, and areas would be explicitly marked as “inside/outside”, etc.

To the OP:
You might find this discussion interesting:

While your request is interesting, it seems it’ll be a better idea to script that delayed sounds for the specific cases where you need them. I.e. treat those sounds as special fashion.

I also remember the talk about Doom 3 development. It is said that those guys originally developed a system that allowed dynamic propogation of sounds between rooms. Well, they apparently found it hard to control, and decided that results didn’t sound “right”. So they scrapped it.