- Home /
Hearing audio outside max distance
Okay, I'm trying to set up ambient city noise outside the building in my scene. However, when I make the audio source, it plays the sound (quite loudly, too) even outside the maximum distance I specified. I've tried everything I can think of- messing with the size of the min and max distances, trying both linear and logarithmic rolloff, nothing works.
I'm having the same problem with other sounds in my scene, and it's getting really frustrating. Does anyone have a solution for this?
Ever find a solution for this? I have all my sounds set to 3d and the sounds still play beyond the max distance.
Answer by kingcoyote · Apr 02, 2015 at 04:38 AM
I've been having this same problem and it seems the Unity 5 solution is to set the Audio Source's Spatial Blend setting to 1. The slider is in the same section as Priority and Volume. When set to 0, the distance settings are ignored.
@kingcoyote It´s a solution for the volume rolloff. But the Spatial Blend set to 1 distorts the audio...It´s there another solution to this problem?
That's the Doppler level, if you set it to 0 you'll have no distortion.
It is so obvius and indeed didn t find it on the docs...
Answer by whitneymisch · Sep 17, 2014 at 02:36 AM
I was having the same problem! I switched the volume rolloff from Logarithmic to custom, and then it worked! Not sure why logarithmic didn't work though.
whitneymisch
maxDistance behaviour is different for Linear and Logarithmic roloff. For logarithmic rolloff the sound doesn't stop playing, it only stops attenuating. Odd but that's the way Unity works here.
http://docs.unity3d.com/ScriptReference/AudioSource-maxDistance.html
Thankyou for posting that fixed up the problem I was having
4 years passed, version 2017.3.1, your solution still works and the answer is still valid :)
Thank you! This was the solution for me to not hear sounds outside the max range.
no9rg's comment is the answer why it doesn't work with logarithmic falloff. In my opinion, they should give an option to have logarithmic falloff, but no sound outside the range.
Answer by wderstine · Jul 12, 2017 at 03:42 AM
@ashapi3 When you first create an audio source the default max distance is 500 and the curve is set to meet zero on the Y axis at 500.
If you edit the max distance in the input field the curve is still the same and doesn't conform to your newly edited max distance.
So you have to edit it so that the last node on your curve is hitting zero otherwise the actual max distance is still 500. You might have to set it back to 500 so that you can delete unnecessary nodes so you don't get weird bumps in your curve out at far distances before setting it to the desired max distance.
+wderstine But if you edit the last node it automatically changes the Rolloff from logarithmic to custom.
Answer by marji_sound · Dec 28, 2013 at 05:43 PM
And if you need to eliminate panning but also have the effect of roll of at max distance, you can leave the pan at 1 but set the spread to 180 which will remove left-right panning.
Answer by jpatinop80 · May 15, 2016 at 01:33 PM
Like the other said You Have to activate 3d sound with slider on Spatial Blend, But the important thing is the "audio listener".. must be on the object is getting near or far from 3d sound.
Your answer
Follow this Question
Related Questions
WebGL audiosource max distance not working 1 Answer
webgl volume just doesnt work 0 Answers
Audio Source Volume not Fading Over Distance 6 Answers
How to get current volume of an AudioSource. 3 Answers
Is there a way to create a random Audiosource loop? 2 Answers