# Controlling multiple parameters at different rates with one slider?



## jfino (Dec 20, 2017)

Hi everyone,
Noob question...

How do you go about controlling multiple parameters at different rates with one slider?
example:
Tape Saturator Gain And Compressor ratio

thanks in advance!


----------



## polypx (Dec 20, 2017)

scaling


----------



## jfino (Dec 20, 2017)

polypx said:


> scaling


Thanks for the reply, How is scaling done? or where can I learn more about it?
thanks so much for pointing me in the right direction.


----------



## beely (Dec 20, 2017)

It's mostly just maths, eg if you want a slider to increase at twice the rate so it's at 1000000 at the mid way point, then you can multiply it's value by two.

So you'll need to figure out what parameters and what ranges/directions you need, take the base slider value, and work out what the actual values you'll update with are going to be.

It's mostly multiplies or divides to scale values, or sometimes you can use different scaling rules like log/exp etc.


----------



## Tod (Dec 20, 2017)

Heh heh, polypx kind of left it hanging out there didn't he.  He's right though.

The way it appears, you want to adjust one control at a certain rate while adjusting another control at a different but certain rate. Not being a great mathematician, I would create two corresponding arrays based on their relationship at different stages. How tight you want them to be would determine the number of stages where you measure them.

Maybe someone with better math skills will have a better idea. 

Oops beely popped in while I was typing and thinking, but he's basically talking about the same thing.


----------



## jfino (Dec 20, 2017)

thanks so much for the replies guys really helped!
Converting to percentages makes it super easy to set the values.


```
on init
message ("")
declare ui_slider $master (0,1000000)
declare ui_slider $a (0,1000000)
declare ui_slider $b (0,1000000)
declare ui_slider $c (0,1000000)
end on

on ui_control ($master)
    $a := $master/100 *20{% of $master}
    $b := $master/100 *50{%}
    $c := $master/100 *80{%}
end on
```


----------



## EvilDragon (Dec 21, 2017)

You will want to multiply first before dividing (due to use of integers by default in KSP).


----------



## magneto538 (Dec 21, 2017)

Also, if you are using Koala, there is a pretty useful scaling function similar to Max MSP's 'scale' object. I have added it recently so perhaps people still don't know about it. You can set the min and max input value and the min and max output value. You can learn more here: math.scale


----------



## jfino (Dec 23, 2017)

thanks so much for the help so far, now I need help with part 2 
I would like that when the values on the other sliders are adjusted on screen and then you move the master slider, the other sliders move relative to the master but now calculating from the new value.
Hope that makes sense!

How is this done? I've been trying to figure it out all day but my knowledge is limited.

thanks again for the help and Merry Christmas!


----------

