Nonlinear scaling of parameter values?

    Jan 10 2012 | 7:44 pm
    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

    • Jan 10 2012 | 7:52 pm
      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.
    • Jan 10 2012 | 7:58 pm
      Hi Roman,
      Thanks for this!
      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
    • Jan 10 2012 | 10:12 pm
      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.
      Here's a little sample patch for you
    • Jan 10 2012 | 10:40 pm
      Or in one object: [expr pow($f1,4)*9.6+0.4]
    • Jan 10 2012 | 10:45 pm
      You've got me there Luke :)
    • Jan 11 2012 | 9:56 am
      Wow! Much obliged for your assistance. You guys are the best!