Forums > MaxMSP

user-variable scaling

January 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)


January 11, 2013 | 6:10 pm

note to self

http://cycling74.com/forums/topic.php?id=42030


January 11, 2013 | 6:40 pm

Hi,

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


January 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


Viewing 4 posts - 1 through 4 (of 4 total)