|
|||
I'd really like a nice equation to emulate mixer faders. Something that maps a slider 0-1 to a 0-1 gain that has a appropriate logarithmic curve. Efficiency is irrelevant. |
|||
| ^ | Joined: 05 Mar 2012 Member: #276393 | ||
|
|||
Well, in theory you can simply start with dBgain equation like the following:
gain = 10^(dBgain/20) = exp(log(10) * dbGain/20) So if the slider position is in decibels (say -80 to +20 or whatever) you'd just plug the decibel gain into to above to calculate gain to apply. The main problem with using the above directly is that you can't take the gain all the way down to zero. If you want that, you could offset the whole thing down a bit like so: gain = 10^(dBgain/20) - 10^(dBgainMin/20) where dBgainMin would be the logarithmic decibel gain at the minimum position (eg -80 in the above). Since 10^(-80/20) = 10^-4 = 0.0001 your "0dB gain" is now 0.9999 or roughly -0.000043dB which is very close to unity, but if you really wanted exact unity at unity-setting then we could fix that too to get the following gain = (10^(dBgain/20) - 10^(dBgainMin/20)) / (1 - 10^(dbGainMin/20)) This is still really only a single exponential (since the second one is constant) so it's not too inefficient either. You could shape it further if you wanted particular positions to give some particular values, but the above should be rather workable. Basically with "dBgainMin" set to -80, you get very close to logarithmic response from about -60dB up, which then tapers smoothly to linear control at the very bottom of the range. So the whole thing in pseudo-code (with slider in [0,1]) looks something like: dBmin = -80 dBmax = +20 range = dBmax - dBmin zeroShape = 10^(dBmin/20) unityFix = 1 / (1 + zeroShape) gain = (10^((range*slider-dBmin)/20)-zeroShape)*unityFix If you want unity at max value, just set dBmax = 0. If you want it go towards linear control earlier, set dBmin to a larger value (like -60 or something). |
|||
| ^ | Joined: 11 Feb 2006 Member: #97939 Location: Helsinki, Finland | ||
|
|||
friendofphi wrote: I'd really like a nice equation to emulate mixer faders. Something that maps a slider 0-1 to a 0-1 gain that has a appropriate logarithmic curve. Efficiency is irrelevant.
if the fader value is 0.0 to 1.0, like the vst stuff I'm using, I just do value * value. Then you can go louder as needed, like * 10.0. But correct me if I'm wrong. I just thought that was the same as an analog volume control. |
|||
| ^ | Joined: 07 Feb 2011 Member: #249871 | ||
|
|||
no, an "analog control" is usually of the form 1/(1/r1 + 1/r2) but there are major variations.
a lot of db fader tapers go to about -40db and then trail off in a linear taper from there. the log taper can be a mixture of two linearly tapered strips and the equation above applies but there are other methods. some just say "f*** decibels!" and have two linear sections, a super poor piece-wise linear approximation of the model taper. with consoles or devices that have displays showing db, generally the faders will match the response of the vu meters or vice-versa. generally you can assume if the device has a fader label to -50db, the led display shows a 50db range the faders are probably accurate at least to there. you "can" use 4(n^2) but it feels way different and the labels wouldn't be evenly spaced. |
|||
| ^ | Joined: 07 Dec 2004 Member: #50793 | ||
|
|||
Well I don't care about models of volume controls I just meant that in general. In other words a formula that goes from 0 to 1 that sounds like the average volume control, though that average may be subjective. Actually your ear's own response would be the goal wouldn't it but back to the subject of the OP, a formula for linear 0.0 - 1.0 converted to logarithmic 0.0 - 1.0.
(10^(x)-1)/9 is all I could come up with based on what was said here, is that correct at least in the sense of the best approximation, or is there another formula I should try. |
|||
| ^ | Joined: 07 Feb 2011 Member: #249871 | ||
|
|||
rootbear wrote: (10^(x)-1)/9 is all I could come up with based on what was said here, is that correct at least in the sense of the best approximation, or is there another formula I should try. That's not very logarithmic at all. You're using the formula I suggested, yes, but that formula has design parameters (namely "range" is the most important one) and you are essentially designing a slider that has nominal 20dB log-range, but tapers to linear at the bottom of that range (compare: I was suggesting around 60 or more nominal range; this makes it look a whole lot different). That said, I'm not necessary against x*x (I use it for some level controls myself) but it's not really ideal because you have only a little range on top before it start becoming linear (so there's no much accuracy around -40dB for example). |
|||
| ^ | Joined: 11 Feb 2006 Member: #97939 Location: Helsinki, Finland | ||
|
|||
here are 3 pot measurements i did from my x0xb0x
the pots are "log" .. but you decide ![]() ---- It doesn't matter how it sounds.. ..as long as it has BASS and it's LOUD! |
|||
| ^ | Joined: 04 Sep 2006 Member: #118997 Location: 127.0.0.1 | ||
|
|||
antto wrote: here are 3 pot measurements i did from my x0xb0x
the pots are "log" .. but you decide That's those crappy "two-linear segments" tapers that aciddose mentioned. So whoever sourced the components for your x0x apparently didn't want to pay extra for proper log-pots (apparently there are rumors that such things actually exist). Anyway, the "linear pot plus shaping resistor" idea is explained here for example. If you're designing new analog circuits, I think that's the easier way to go since you can use a cheap linear pot and still get a smooth response. |
|||
| ^ | Joined: 11 Feb 2006 Member: #97939 Location: Helsinki, Finland | ||
|
|||
mystran wrote: ..So whoever sourced the components for your x0x apparently didn't want to pay extra for proper log-pots (apparently there are rumors that such things actually exist).
i think the TB-303 uses pots with the same "cheap log" response ---- It doesn't matter how it sounds.. ..as long as it has BASS and it's LOUD! |
|||
| ^ | Joined: 04 Sep 2006 Member: #118997 Location: 127.0.0.1 | ||
|
|||
antto wrote: mystran wrote: ..So whoever sourced the components for your x0x apparently didn't want to pay extra for proper log-pots (apparently there are rumors that such things actually exist).
i think the TB-303 uses pots with the same "cheap log" response No idea to be honest. Unsurprisingly it appears that the originals aren't even made anymore. I found some information regarding 303 pots but that doesn't really talk anything about the log-tapers on the originals. Not that it's such a huge deal, proper log-response mostly just feels nicer. |
|||
| ^ | Joined: 11 Feb 2006 Member: #97939 Location: Helsinki, Finland | ||
|
|||
I wouldn't mind any piecewise linear or hocus pocus function-based fader at all. As long as it was documented with the device I am okay with whatever. The piecewise linear curve would work just fine for a mix fader, and might be preferred in some circumstances.
I love digital! All this stuff is a cinch to create and really adds custom vibe to everything! ---- ![]() |
|||
| ^ | Joined: 16 Feb 2005 Member: #58183 | ||
|
|||
I'm going to start with the first post here, I don't really see how converting from db helps, -80db to 20db doesn't match to 0-1.
I'm using the square function, which seems to work nicely. It sounds like it's getting louder in even increments. And I can easily root to do meters. I appreciated that graph, it would be cool to overlay the x^2 on it. |
|||
| ^ | Joined: 05 Mar 2012 Member: #276393 | ||
|
|||
I often use square as well for volume, unless I have a reason not to (it's also the response most DAWs use, last time I checked).
Richard |
|||
| ^ | Joined: 19 Dec 2010 Member: #245936 | ||
|
|||
friendofphi wrote: I'd really like a nice equation to emulate mixer faders. Something that maps a slider 0-1 to a 0-1 gain that has a appropriate logarithmic curve. Efficiency is irrelevant.
Like the red line here: http://tinyurl.com/cu7szta ? |
|||
| ^ | Joined: 24 Feb 2004 Member: #13779 Location: Germany |
| KVR Forum Index » DSP and Plug-in Development | All times are GMT - 8 Hours |
|
Printable version |
Disclaimer: All communications made available as part of this forum and any opinions, advice, statements, views or other information expressed in this forum are solely provided by, and the responsibility of, the person posting such communication and not of kvraudio.com (unless kvraudio.com is specifically identified as the author of the communication).
Powered by phpBB © phpBB Group




















