Forums > MaxMSP

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.


-- Pasted Max Patch, click to expand. --

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.


MIB
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.

-110

[attachment=176159,2892]

Attachments:
  1. mlogbipolar.jpg

    mlogbipolar.jpg


EMV
Nov 13 2011 | 9:42 am

Nice idea. Here’s some more.


-- Pasted Max Patch, click to expand. --


dtr
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

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

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!


-- Pasted Max Patch, click to expand. --

Nov 15 2011 | 11:48 pm

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?

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

soon.

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.

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
Dec 26 2011 | 5:13 am

oops.

Attachments:
  1. 110.defarg.mxb.zip
Dec 31 2011 | 7:06 pm

lalala.

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

Let me know your comments!

Cheers,
Ádám

Sep 01 2013 | 5:28 am

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!

Sep 01 2013 | 9:22 am

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

Sep 01 2013 | 6:51 pm

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 01 2013 | 7:22 pm

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

Sep 01 2013 | 8:46 pm

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/

Sep 02 2013 | 2:17 am

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.

Sep 02 2013 | 7:24 am

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/

Sep 02 2013 | 7:47 am

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 | 8:08 am

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

Oct 14 2014 | 12: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 | 1:24 pm

I think it’s more helpful if we keep the discussion in one thread instead.

Oct 14 2014 | 5:56 pm

define "importance", and explain why exponential or log won´t do.

(and someone tell me if the comma is right between the imperatives)

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

Forums > MaxMSP