user-variable scaling

    Jan 11 2013 | 4:10 pm
    Hi I waste an awful amount of time doing input scaling maths, with only basic maths chops. The scale object isn't flexible enough to allow me to do the following, without a serious amount of trial and error (usually tweaking the exponent, or faffing around with [expr]):
    0. --> N/2 --> N
    0. --> X --> Y
    for example 0. --> 0.5 --> 1. outputs 0. --> 100 --> 1000.
    Is there a simple formula which would allow me to define N, X and Y? This would save a vast amount of time trawling the forum and reposting essentially the same question for different values.
    Many thanks (preemptive hanging head in shame)

    • Jan 11 2013 | 6:40 pm
      there's a generic interpolation object in The sadam Library called [sadam.interpol] that handles piecewise linear, polinomial, Bézier and spline interpolations. Unfortunately, none of these interpolation methods fulfill exactly the needs that were posted on the thread that you linked, but perhaps you could also have a look at it. For example, if it's not a need that (in your example) 0.5 should link exactly to 100 (in other words, if in your specific case, 250 would be good enough for the input at 0.5) you can pick Bézier interpolation. The advantage is that you get a very smooth function at the end of the day.
      Hope that helps, Ádám
    • Jan 11 2013 | 7:05 pm
      Hi Adam I think Rodrigo's thread specifically addresses my need for min/max/mean (or median) in/out. However, having lurked on this forum for many years, I think it's time I investigated your library. Might save me a lot of head scratching
      Thanks Brendan