Nonlinear scaling of parameter values?
Hi All,
My dabblings in Max have improved greatly, and I am almost starting to feel comfortable about using Max, and a big thanks for that goes out to all of you! Without this forum I'd still be stuck with trying to get my head around the environment :)
But yeah, have another question to ask y'all (tried searching but no help) - I need to scale a parameter value (using 0. - 1. range for the input) to the range of 0.4 - 10.0, which itself is easy enough.. but the thing is, I want the value of 1. to be exactly at 50% of the parameter range (ie. 0.5 in the controlling input param)!!
Is there an easy way of getting such a range, or do I have to resort to building some kind of param eval logic to the knob? Something like "if value less than 1 -> scale like this / else scale like this"? Sounds like a hack to me.. there has to be a more elegant solution?
TIA & Cheers
try the knee thing (or try all of them)
note that it also would be possible to do this knee thing only with only one [expr] object.
Hi Roman,
Thanks for this!
Cheers
EDIT: Alas, your kneepatches went over my head.. I'll get a mate who's a C programming whiz to explain a bit about expr stuff.. ATM I am using a function object with interpolation to do the scaling for me (as found in one of the patches in that brilliant thread) :p
depends on how you want the function to 'look'. For a smooth function you could try something of the form
y = a + b*x^c
we get a and b from the constraints directly, a = 0.4, b = 9.6, then solving for the case when y=1, x=0.5, we get
1 = 0.4 + 9.6*0.5^c
0.6/9.8 = 0.5^c
c = ln(0.6/9.6)/ln(0.5)
which just happens to be c = 4
so your mapping is y = 0.4 + 9.6*x^4
which you can patch directly.
EDIT
Here's a little sample patch for you
Or in one object: [expr pow($f1,4)*9.6+0.4]
You've got me there Luke :)
Wow! Much obliged for your assistance. You guys are the best!