Search Unity

Audio Manually evaluating an AudioSource's rolloff

Discussion in 'Audio & Video' started by Estecka, Aug 2, 2018.

  1. Estecka

    Estecka

    Joined:
    Oct 11, 2013
    Posts:
    62
    I am trying to get the rolloff curve of an AudioSource, in order to evaluate its rolloff at an arbitrary distance.

    I found
     AudioSource.GetCustomCurve()
    , but it only returns the right curve if the source's rolloff mode is set to "Custom".
    I could potentially calculate a linear rolloff by myself, but I have no idea how the Logarithmic rolloff works.

    Is there a built-in way to get the rolloff curve/evaluate the rolloff regardless of the mode ?
    Else, how do I evaluate a logarithmic rolloff ?
     
  2. Estecka

    Estecka

    Joined:
    Oct 11, 2013
    Posts:
    62
    Any help would be highly appreciated.
    At this point assuming there is no magical built-in way, I'd simply need to know the math behind the Logarithmic Rolloff to find my way out.
     
  3. Docaroo

    Docaroo

    Joined:
    Nov 7, 2017
    Posts:
    82
    We use custom animation curves that are stored as parameters. You could do the rolloff based on these animation curves and then they are tweakable easily too!