Forums > MaxMSP

Inverse proportionality

October 29, 2008 | 9:42 pm

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


October 29, 2008 | 10:03 pm

How about using a !- object?

– Pasted Max Patch, click to expand. –

October 29, 2008 | 10:14 pm

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;


October 29, 2008 | 10:17 pm

[scale 0 8000 8000 0]


October 29, 2008 | 10:18 pm

ha, thanx, i needed that one, too.


October 29, 2008 | 10:22 pm

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


October 29, 2008 | 10:25 pm

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

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

add that one to the list: !- 8000

;-)

ej


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