How to get a natural falloff for audio sources?

I’m playing with the different rolloff settings trying to get a natural falloff for my audio sources, but I’m failing badly. Anyone have any tips for me?

Linear rolloff seems out of the question, but Logarithmic Rolloff isn’t really giving me what I’m after either. I have to set the min distance really low or else sounds far away will sound like they are close by, but with the min distance set really low even close sounds sound like they are far away. I’m unable to achieve both with the Logarithmic rolloff and there isn’t exactly many settings to play with.

That only leaves the custom rolloff. I’m sure I can achieve something here, but there’s no way to copy/paste these curves and I really dislike having to fiddle with them in the first place. I don’t like having different curves for different things. I want all my audio sources to adhere to the same “rules” so to speak. And editing the curves is a nightmare for a perfectionist like myself. I don’t want my point in 4.018, 0.698, I want it in exactly 4.0, 0.7. :stuck_out_tongue:

I’ve been looking at some official Unity scenes and they all seem to be using the custom rolloff, but they don’t sound natural at all. In the Unity Labs scene for instance the curve is setup such that you can’t even hear the doors closing even if you’re just 10 meters away.

I’m using the Stealth tutorial scene for testing with the robot guards walking around. The scene seems to be pretty realistic in terms of scale and it is about 30x50 meters.

I want it like it is in Counter-Strike for example where you can easily tell if someone is just around the corner or in the next building.

Edit: Hmm, perhaps I’ve worded the question poorly. I want sounds to sound different based on distance. Distant sounds should sound more distant. :stuck_out_tongue: There may be more to it than just volume I guess. Do I have to play with pitch and filters depending on distance? I was sort of hoping the Logarithmic Rolloff was all it took, but I may have to do some reading on the subject I guess.

What it comes to sound, lower frequencies travel farther because higher freqs tend to lose their energy faster. However what it comes to real life, you wouldn’t be able to tell a difference in short ranges, unless there is high enough density of matter to absorb the energy of sound waves.

Experiment with lowpass filter. Manipulate cutoff frequency based on distance. For volume rolloff, at the moment you can’t set custom curves at runtime, but it’s coming in 5.2.

Thanks, chelnok.

I managed to get a system going that I’m fairly pleased with. Anyone interested can see it in action or download the entire project to look at it here:

I routed all sounds through a common audio manager. Every time a sound is played the audio manager checks the distance from the sound to the listener and whether or not the listener is occluded (just a simple raycast check). The audio manager then tweaks a low pass filter and the pitch of the sound before playing it.

I playtested my game with a headset and I felt the system gave a fairly good indication of where sounds were coming from. The low pass filter effect when hearing someone come around a corner is especially neat. And how the low pass filter completely removes certain sounds like the servo sound of the cameras over long distances, but keeps sounds like foot steps because they are much deeper is really cool.

It’s a bit rough, but I think it has potential.

3 Likes