Search Unity

Audio use a slider to change DB on a mixer?

Discussion in 'Audio & Video' started by TheDodgerUk1, Dec 19, 2019.

  1. TheDodgerUk1

    TheDodgerUk1

    Joined:
    Dec 3, 2013
    Posts:
    61
    i wish to use a slider to change the AudioMixer Values, the AudioMixer range is -90 to +20

    so to do -90 to 0 is a simple
    Code (CSharp):
    1. 20.0f * log10(sliderPercentage);
    but to get it to +20, i cant figure it out, unless i do a if(DbIWant > 0 ) kind of thing

    slider.PNG

    so i can use a normal slider next to this and get the correct decibels
     
    Last edited: Dec 19, 2019
    elfnik likes this.
  2. elfnik

    elfnik

    Joined:
    Feb 3, 2018
    Posts:
    8
    It's sad that nobody has gave an answer to this question in years, but I just had this problem and got a solution on my won, which is very funny, but works with exactly this piece of code you have just asked for. I see you are still active in 2020 and i`m sure this might help you and many other people, so here is the answer:

    In the "Slider" UI element in the inspector set the max value to ~6 (or more) somehow it works, maybe not the best solution but it works. Here is a screenshot:
    upload_2020-10-20_21-49-12.png