Hallo, vanDongen/Gilcher hat gesagt: // vanDongen/Gilcher wrote:
You want to map a range of 0.5 length f.i. starting at 0.1 to another range starting at 0 or any other number. You do that by
subtract the smallest number (so that is mapped to zero)
You need not necessarily use the smallest number, though. If you want to invert the input and for example map [127,10] to [20,40] it's possible as well like this (x is input):
x-127
although 10 and not 127 would be the smaller number, or more generally:
(x-il) * (il-ih)/(ol-oh) + ol
and in "expr" form for Pd:
[ expr ($f1-$f2) * ($f4-$f5) / ($f2-$f3) + $f4 ]
using input, from_low, from_hi, to_low, to_high as inlets.
Basically this all is an application of the "rule of three" from school.
Frank Barknecht _ ______footils.org__