Download

Get the volume of a sound at location based on attenuation

Hi all,
I am working on a game where one player will control multiple drones, trying to catch other players. Since they will only possess one drone at a time, I wanted some visual feedback for the non-possessed drones, so the player can still monitor them. I have set up scene capture components so that the player can see the viewpoint of the non-possessed drones, now I’m working on audio.

I would like to add a volume indicator for what the drone is hearing and have found a way to notify the drones using onAudioSingleEnvelopeValue, but the volume from this event does not take in to account the attenuation of the sound over distance. Is there any way to get the volume of a sound at a given location/actor without manually calculating the attenuation curve formula?

Thanks for your help,
Matt

Hmm, that’s an interesting problem.

I think my first approach at solving this would be to use the Volume Envelope on the important sound sources and cache that locally on the Actors as a CurrentVolume float. Then I would have my drones loop through those Actors, collecting their CurrentVolume and their Distance from that drone, calculate a simple attenuation, and then sum the results to their Meter float value and then set up their level with a fairly quick FInterpTo or something to smooth out the meter changes. I might add some low-level random float values to simulate ‘background audio.’

Hi Dan, sorry for the delay in replying, I’ve been away for a while. Thanks for your help with this that’s a good idea to have the drones loop through the actors rather than vice versa (as I have been doing) to avoid problems with multiple sounds triggering at different times and the volume only reflecting the last notified sound… I hadn’t thought about that until now.

Re the caching idea, is there some way I could store the audio curves (potentially in a lookup table at a reduced sample rate) at compile time to save on compute time in the game?

Thanks again for all your help

I should also mention that since audio will play an important role in locating the player who is trying to hide, there will be no non-diegetic sounds