Re-mapping a range of numbers - add your tricks here....

    Nov 12 2011 | 3:36 pm
    Hi all,
    Often the most useful things are the simplest building blocks. One of the most fundamental must be ways of converting a range of numbers to create more interesting and useful curves etc. I thought a nice post would be to collect everyone's thoughts and tricks on this idea. See the included patch and all will become clear. Please add anything you find useful and re-post.

    • Nov 12 2011 | 6:01 pm
      Excellent idea Mark; pre-empting many future posts too. I'll have a HD clear out and see what I can find.
    • Nov 12 2011 | 6:56 pm
      nice. never occurred to me to use function in this way! new trick learned, thanks!!
    • Nov 12 2011 | 10:49 pm
      i have a bigger set of abstractions which can distort a range of numbers, as i found that you simply need that to build GUI stuff.
      the most basic version uses different functions such as pow, exp, log, tanh and so on, and the input and output ranges are always 0. - 1.
      then there are abstractions which work with a user-given range. they accept arguments like "107 250" and perform the above functions on the chosen input range - as well as output a curve of that range.
      further abstractions work bipolar - the input range is split in the middle, and calculations like exp or log are done to both halves individually, in opposite direction.
      last but not least you could take a range of 0-20 and perform such a distortion only to 0-12 and leave the rest of the range as it is: linear.
      and where mathematical stuff wont work anymore, there is always table or coll to translate n to m.
    • Nov 13 2011 | 9:42 am
      Nice idea. Here's some more.
    • Nov 14 2011 | 3:48 pm
      good stuff! keep m coming :)
      i'll add mine when i bump into them...
    • Nov 14 2011 | 4:34 pm
      Yes, thanks for all your additions.
      Roman, are your abstractions available online? or can you add some here? I really like the idea of splitting the range across different equations, will give this a try when I've got time.
    • Nov 15 2011 | 1:20 am
      another solution for splitted-range mapping: a combo with [sadam.split] and cascaded [zmap] objects:
      (You need The sadam Library for this, available at ).
      Cheers, Ádám
    • Nov 15 2011 | 10:06 am
      Here's a way to get a circular mapping, though I still don't really understand polar and cartesian co-ordinates!
    • Nov 15 2011 | 11:48 pm
      Have added the new additions to the main collection:
      Next thing is to do an MSP version.... any takers?
    • Dec 05 2011 | 9:55 pm
      just want to bump this,
      for clotilda's non sequitur excellentia (what's Latin for "spam"?) .
      Like digital monkeys hacking away in cyber-space, they throw up a rare gem of unadulterated beauty
      Oíche mhaith
    • Dec 07 2011 | 2:06 am
    • Dec 26 2011 | 5:03 am
      so, i have modularized my mapping abstractions now.
      some of them do now need 3 times more CPU than before, but this way the stuff is easier to extend or change.
      the MAP objects distort a range of n-m and map it to another range, the MAKE objects take a range of n-m and created distorted output of the same range, the DO objects work on a range of 0. - 1. just maps linear, maps from n-m to 0.-1. and the other way round.
      the log, exp, pow, and trunc distortions require an argument, the other functions dont. this argument always has to follow the range arguments. example: in [ 0 127 1 50 90] the 90 belongs to the "log".
      look into [110-map-overview] and [110-map build yourself].
    • Dec 26 2011 | 5:13 am
    • Dec 31 2011 | 7:06 pm
    • Oct 08 2012 | 4:42 pm
      Hi remappers,
      I just finished an external that re-maps numbers (or lists) using several different interpolation methods. Currently Bézier, piecewise linear, polinomial and spline interpolations are supported, and I plan to extend it with more complex things as well, like Hermite-interpolation or exponential fit.
      The object is called [sadam.interpol] and is part of The sadam Library: .
      Let me know your comments!
      Cheers, Ádám
    • Sep 01 2013 | 12:28 pm
      This thread is full of awesome. Thank you everyone for the input!
      Roman, there appears to be a missing external in your bundled goodies. Something called 110.isolate... the absence of which is causing many of the other externals and many of your examples to brick. You don't by any chance have that handy do you? Can you post it?
    • Sep 01 2013 | 4:22 pm
      troll abstraction 110.isolate: Isolates the rest of your patch. Classic Roman.
    • Sep 02 2013 | 1:51 am
      oh my goodness. yes, that is because "isolate" is a new abstraction from 2011, i was using something else before.
      [110.isolate] is a bit like [split] but has three outputs: the center value of the range, greater than that, and smaller like that. this is required for _some of the possible operations you can do when distorting a range of numbers bipolar. the idea is to leave the center value untouched while distorting the rest.
      the reason why it is required is, last but not least, the fact that [expr] has that fascistic size limit for the input string, so somewhere there has to be an interface between parts of the code.
    • Sep 02 2013 | 2:22 am
      Hey that did the trick. Everything is working now. Very cool. Thank you!
    • Sep 02 2013 | 3:46 am
      What I would love to see is an upgrade of [line] that incorporates all of Robert Penner's easing algorithm. I think I've seen javascript or expr-based abstractions based on them but a fast, native object would be awesome. Every animation package I know, from ActionScript to hundreds of javascript frameworks, use this same set.
    • Sep 02 2013 | 9:17 am
      I'd love that, too. It's one of the few remaining bits I miss from vvvv. does good easing, but sometimes you just want a single number being all rubbery and nice.
      I've been messing about with [expr sin($f1*6.28318531*[number of oscillations]] for a couple of weeks now, really loving it. We have a player in our group, who plays the wacom tablet for some granular stuff, and we're doing some data visualisation. Well, turns out his single XYZ point wasn't too jazzy, so we spruced it up with some sin(x) there, and it really helped.
    • Sep 02 2013 | 2:24 pm
      Oh man.. I am absolutely reeling over Penner's easing equations...
      Check this out this applet:
      And how can something like this be implemented in Max?:
    • Sep 02 2013 | 2:47 pm
      most of them are simple, for the bounce and bend stuff i´d use the pmpd 2d external.
      for GUI stuff and other small ranges of low resolution one should precalculate complex curves and then use translations tables IMHO.
    • Sep 02 2013 | 3:08 pm
      What a wonderful find (probably been around for ages though!!); my love affair with the interwebs is re-ignited:
    • Oct 14 2014 | 7:22 pm
      just catching up this interested topic. i already posted something in an another topic, and Brendan kindly answer it... but i don't get it work
      I am willing to re mapped incoming data let say from a range of - 50 to 50, to an output with a 'curve' that gives more importance to data as it gets closer to 0 (from both sides). I tried to adapt the sadam.split, but i don't get 0 for 0. I am missing something
      any help is welcome! thx! eric
    • Oct 14 2014 | 8:24 pm
      I think it's more helpful if we keep the discussion in one thread instead.
    • Oct 15 2014 | 12:56 am
      define "importance", and explain why exponential or log won´t do.
      (and someone tell me if the comma is right between the imperatives)