Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Audio volume does not fade out to zero over distance

Discussion in 'Editor & General Support' started by tiagoandr, Apr 25, 2020.

  1. tiagoandr

    tiagoandr

    Joined:
    Jun 30, 2019
    Posts:
    25
    Hello,
    I have read several topics about this subject but unfortunately even doing what they recommended I got no results. Means, when the player walks away from the audio generation source, the audio clip volume does not go down to zero as expected (I hear the sound kms away still, not so loud but still possible to hear).

    Spatial blend set to 1 (3D).

    I tried all rolloffs setups,
    Logarithm as per pic below, from 1 to 5 (to try - but I could hear the sound at position 20 for example)
    Linear and also Custom, always setting up the minimum distance to 0.1 or 1 or 2... max distance to 5 or 10... but at the end, always listening when at position 20, 30, 50.. etc

    Anyone has any idea about what's going on here?

    ** I am playing the audio source as: gunShot.Play();
    ** Also tried: AudioSource.PlayClipAtPoint() and the results were the same...
     

    Attached Files:

    Last edited: Apr 25, 2020
    Tymianek likes this.
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,890
    Based on your screenshot it looks like your 3d sounds settings curve only drops down to about .2 or so. If you want the sound to be completely silent at some point it needs to drop down to 0, right? Check out the curves in the docs, which all go to zero at some point: https://docs.unity3d.com/Manual/class-AudioSource.html
     
  3. tiagoandr

    tiagoandr

    Joined:
    Jun 30, 2019
    Posts:
    25
    Hi PraetorBlue - thx for the feedback.
    I did this setup you mentioned on the Linear and Logarithm options.

    Unfortunately, on both cases, when I bring it to zero, the sound does not even run.

    Capture.PNG

    Capture1.PNG
     
  4. tiagoandr

    tiagoandr

    Joined:
    Jun 30, 2019
    Posts:
    25
    Hey yo! figured out!

    I noted the Listener was a bit in a awkward position in the chart... perhaps justifying the no sound condition I mentioned above. Hence, first, I adjusted the curve to zero and then, by adjusting the max distance to 20, the Listener automatically moved to somewhere around 11, per pic below. Which is quite weird for me still but worked :)

    Capture2.PNG
     
  5. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    On a side note: By default the logarithmic rolloff is set to only go to about 0.3 instead of zero when at max distance
    It makes no sense as 99.99% of use cases will want the max distance to be zero.
     
    MaxLohMusic and levexis like this.
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Really?

    It looks pretty zero-ish to me... Unity2021.3.17f1

    I spot-checked Unity5.6.6f2 and Unity2018.4.19f1 and they are all zero by default.

    Screen Shot 2023-06-06 at 8.54.49 AM.png
     
  7. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    If you change the max distance (which everyone will do) it does not scale.

    Sorry I should have clarified this.
     
  8. levexis

    levexis

    Joined:
    Feb 3, 2022
    Posts:
    2
    This is a bug, surely.