Search code examples
c#volumedecibel

How to increment same amount of volume output having different base dB level


let´s say i have a base 10 dB and then i increment this value to 16 dB, there are 6 dB of diference so my volume has changed, but now let´s say i want to increment the same amout of volume to a different value of base dB, for instance i have 50 dB now and i want to add the same amount of volume that i added before, well certanly it isn´t 56dB what i will end up with, i know it's a logarithmic equation. My question is if there is a formula to find out how much volume i have to increment any time based on a previous amount of volume change?

notes: 1)my volume control goes from 0 to 1 2)i don't just increment te volume and forget the rest because i need to make the sound change it's volume dynamically while it is being played


Solution

  • Sound like you're looking for 'Percent Change'.

    ((y2 - y1) / y1) = percentage change

    ((16-10)/10) = 0.6

    http://www.percent-change.com/index.php?y1=10&y2=16

    A Start: 10dB

    A Finish: 16dB

    A Delta: 6dB

    A Percent Change = 0.6

    B Start: 50dB

    B Finish: (((A Finish - A Start) / A Start) * B Start) + B Start

    (((16-10)/10)*50)+50 = 80

    In your example the 50dB should be increased to 80dB.