gain~ internal formulas

Oct 05 2008 | 7:54 pm
I'm trying to understand the internal workings of the gain~ object. Specifically, what is the formula it uses to derive its scale factor for scaling the amplitude of the incoming signal?
I don't understand the meaning of the "log increment" attribute (defaults to 1.071519) and the "log scale value" attribute (defaults to 7.94321). What is the formula that these constants are getting plugged into? There is no indication in the gain~ help file of what these values actually represent, and what will result from changing these values.
Thanks

• Oct 05 2008 | 9:36 pm
On 05 Oct 2008, at 21:54, Scott wrote: > > I'm trying to understand the internal workings of the gain~ > object. Specifically, what is the formula it uses to derive its > scale factor for scaling the amplitude of the incoming signal? > > I don't understand the meaning of the "log increment" attribute > (defaults to 1.071519) and the "log scale value" attribute > (defaults to 7.94321). What is the formula that these constants > are getting plugged into? There is no indication in the gain~ help > file of what these values actually represent, and what will result > from changing these values. > hi scott, the help file (max 4.6) says it's the same formula as for linedrive (which is the same as for [scale] i believe). it's in the max reference.
maybe the patch below sheds some light on the inner workings.
volker.
• Oct 06 2008 | 8:37 am
• Oct 06 2008 | 11:49 pm
volker,
So, from your example patch, it seems that gain~'s formula is:
G = SV * e^(-S * log(I)) * e^(V * log(I))
where:
G = Gain Factor SV = Log Scale Value e = 2.71828183 S = Number of Steps I = Log Increment V = Current Slider Value
Excellent, very helpful! This should be posted in the gain~ help file, in my opinion... or at least in the reference page.
For what it's worth, the above formula can be simplified as:
G = SV * e^((V-S)*log(I))