Scaling of Sliders?

Discuss using the OSC interface to control SL

Moderator: jesse

Post Reply
EasyMac
Posts: 9
Joined: Thu Apr 02, 2009 10:23 pm

Scaling of Sliders?

Post by EasyMac »

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)?
jesse
Posts: 554
Joined: Sat Sep 06, 2008 9:46 am
Contact:

Re: Scaling of Sliders?

Post by jesse »

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
EasyMac
Posts: 9
Joined: Thu Apr 02, 2009 10:23 pm

Re: Scaling of Sliders?

Post by EasyMac »

Perfect.
Thanks.
Post Reply