Inverse proportionality

Oct 29, 2008 at 9:42pm

Inverse proportionality

hi,
i need to transform a stream of data (numbers) i receive from the serial port in numbers that behave in the opposite way.
there, where i have great values (8000) i need 0 and when the great value decrease i need the small one to increase (7999=1)…
i don’t know if my explanation is clear enough… i rekon it’s called inverse proportionality and i suppose it’s easy to do but i’m a stupid with numbers.
how can i do it with max math?
thank you very much
al

#40566
Oct 29, 2008 at 10:03pm

How about using a !- object?

– Pasted Max Patch, click to expand. –
#143669
Oct 29, 2008 at 10:14pm

This does what you want, too:

max v2;
#N vpatcher 10 59 610 459;
#P window setfont “Sans Serif” 9.;
#P number 196 210 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 196 175 43 196617 + 4000;
#P newex 196 151 31 196617 * -1;
#P newex 196 129 42 196617 – 4000;
#P number 67 212 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 130 58 15 0;
#P newex 130 79 64 196617 metro 1000;
#P newex 130 102 70 196617 random 8000;
#P connect 0 0 3 0;
#P connect 2 0 1 0;
#P connect 1 0 0 0;
#P connect 0 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P pop;

#143670
Oct 29, 2008 at 10:17pm

[scale 0 8000 8000 0]

#143671
Oct 29, 2008 at 10:18pm

ha, thanx, i needed that one, too.

#143672
Oct 29, 2008 at 10:22pm

thank you Brennon
!- 8000 was the stuff i was looking for
it was so simple…;-)

#143673
Oct 29, 2008 at 10:25pm

On 29 oct. 08, at 23:18, jayrope wrote:

> ha, thanx, i needed that one, too.

add that one to the list: !- 8000

;-)

ej

#143674

You must be logged in to reply to this topic.