So, I'm trying to control the sliders in SL with sliders in PureData. I'm sending the new values out of Pd by OSC.
I'm starting with the dry slider.
I tried sending them out as a linear scale between 0 and 1, but that yields nonlinear results visually in SL.
Also, I understand that moving the slider linearly (visually) yields nonlinear dB values (which is, itself a nonlinear scale)
To make things simple, I want to just figure ot how to map linear movement of a slider in Pd to linear VISUAL movement of the slider in SL. Could you tell me what math scaling happens to convert the OSC input to visual slider output (on the channel dry slider, specifically, if they're different for different volume sliders)?
Scaling of Sliders?
Moderator: jesse
Re: Scaling of Sliders?
Yes, the gain sliders use a somewhat arcane mapping from gain ratio to slider position ratio and back. Here it is:
zero maps to 0 for both, then:
gain->slider
SLIDER_RATIO = pow((6.0*log(GAIN_RATIO)/log(2.0)+198.0)/198.0, 8.0);
slider->gain:
GAIN_RATIO = pow (2.0,(sqrt(sqrt(sqrt(SLIDER_RATIO)))*198.0-198.0)/6.0);
jlc
zero maps to 0 for both, then:
gain->slider
SLIDER_RATIO = pow((6.0*log(GAIN_RATIO)/log(2.0)+198.0)/198.0, 8.0);
slider->gain:
GAIN_RATIO = pow (2.0,(sqrt(sqrt(sqrt(SLIDER_RATIO)))*198.0-198.0)/6.0);
jlc