Programming Volume Controls

I’ve referred to this several times and thought others might be interested.

https://www.dr-lex.be/info-stuff/volumecontrols.html

4 Likes

Definitely good advice - it’s similar to hardware - you can get non-linear pots for volume, so why use linear ones?

1 Like

Very interesting read, thank you.
Now, I may be thick here but how would you implement this in the simplest way possible?
I tried some things to keep the range from 0 to 1, I came up with this expression :


Does that make sense?

1 Like

There are any number of exponential curves that you could possibly use depending on your requirements. Base 10 is commonly used since that is the basis for the dB scale, but it isn’t necessarily require. Your formula uses exp(x) which is e^x or the inverse of a natural log. If you’re happy with the “feel” of the control this is perfectly acceptable. You might consider using x^2 or x*x instead which is fairly close to the curve from your expression, but much lower in CPU usage. The “ideal” curves from the article are much steeper (closer to x^4), but that doesn’t really make them better IMHO. @biminiroad often uses x*x as a low overhead way to get a non-linear response from a gain control. For the linear/exponential VCA I posted, I wanted to have a dB display for the gain so you’ll find the formulas are a bit more involved. Linear/Exponential VCA

3 Likes

Thank you for this!

1 Like