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

Nov 12, 2011 at 3:36pm

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

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.

– Pasted Max Patch, click to expand. –
#59973
Nov 12, 2011 at 6:01pm

Excellent idea Mark; pre-empting many future posts too. I’ll have a HD clear out and see what I can find.

#215933
Nov 12, 2011 at 6:56pm

nice. never occurred to me to use function in this way! new trick learned, thanks!!

#215934
Nov 12, 2011 at 10:49pm

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.

-110

[attachment=176159,2892]

###### Attachments:
#215935
Nov 13, 2011 at 9:42am

Nice idea. Here’s some more.

– Pasted Max Patch, click to expand. –
#215936
Nov 14, 2011 at 3:48pm

good stuff! keep m coming :)

i’ll add mine when i bump into them…

#215937
Nov 14, 2011 at 4:34pm

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.

#215938
Nov 15, 2011 at 1:20am

Hi,

another solution for splitted-range mapping: a combo with [sadam.split] and cascaded [zmap] objects:

– Pasted Max Patch, click to expand. –

(You need The sadam Library for this, available at http://www.sadam.hu/en/software ).

Cheers,
Ádám

#215939
Nov 15, 2011 at 10:06am

Here’s a way to get a circular mapping, though I still don’t really understand polar and cartesian co-ordinates!

– Pasted Max Patch, click to expand. –
#215940
Nov 15, 2011 at 11:48pm

Have added the new additions to the main collection:

– Pasted Max Patch, click to expand. –

Next thing is to do an MSP version…. any takers?

#215942
Dec 5, 2011 at 9:55pm

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

#215943
Dec 7, 2011 at 2:06am

soon.

#215944
Dec 26, 2011 at 5:03am

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.

110.map just maps linear, 110.map-down maps from n-m to 0.-1. and 110.map-up 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 [110.map-log 0 127 1 50 90] the 90 belongs to the “log”.

look into [110-map-overview] and [110-map build yourself].

-110

###### Attachments:
1. 110mapWIN.zip
#215945
Dec 26, 2011 at 5:13am

oops.

###### Attachments:
1. 110.defarg.mxb.zip
#215946
Dec 31, 2011 at 7:06pm

lalala.

###### Attachments:
1. kneestuffwin.zip
#215947
Oct 8, 2012 at 4:42pm

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: http://cycling74.com/forums/topic.php?id=42930 .

Cheers,
Ádám

#215948
Sep 1, 2013 at 5:28am

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?

Thanks!

#263893
Sep 1, 2013 at 9:22am

troll abstraction 110.isolate: Isolates the rest of your patch. Classic Roman.

#263903
Sep 1, 2013 at 6:51pm

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.

###### Attachments:
1. 110.isolate.mxb_.zip
#263936
Sep 1, 2013 at 7:22pm

Hey that did the trick. Everything is working now. Very cool. Thank you!

#263938
Sep 1, 2013 at 8:46pm

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. http://www.robertpenner.com/easing/

#263949
Sep 2, 2013 at 2:17am

I’d love that, too. It’s one of the few remaining bits I miss from vvvv. jit.anim.drive 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.

#263976
Sep 2, 2013 at 7:24am

Oh man.. I am absolutely reeling over Penner’s easing equations…

Check this out this applet:

http://jesusgollonet.com/processing/pennerEasing/

And how can something like this be implemented in Max?:

http://www.gizma.com/easing/

#264005
Sep 2, 2013 at 7:47am

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.

#264008
Sep 2, 2013 at 8:08am

What a wonderful find (probably been around for ages though!!); my love affair with the interwebs is re-ignited:

<code>

– Pasted Max Patch, click to expand. –

</code>

Brendan

#264012

You must be logged in to reply to this topic.