Page 1 of 1

reverse a value ?

Posted: 01 Dec 2013 18:04
by oran-outan
HI
I search a away to reverse a value. I'm thinking "range" can do this but :
e = range(x, 0, 10) or e = range(x, 10, 0) back the same result.

How can I reverse a value ???

I have used this below whose run but I think there is more efficient for doing the same... and it's ok for a short list but if more longer °°°
-------
decl i;

if (e == 0) i = 10;
if (e == 1) i = 9;
if (e == 2) i = 8;
if (e == 3) i = 7;
if (e == 4) i = 6;
if (e == 5) i = 5;
if (e == 6) i = 4;
if (e == 7) i = 3;
if (e == 8) i = 2;
if (e == 9) i = 1;
if (e == 10) i = 0;
-------

thanks for your help
0-0

Re: reverse a value ?

Posted: 01 Dec 2013 18:49
by Phil999
if the max value is known:

Code: Select all

i=10-e;
note that you can also reverse object's in/output values in the scale section. By default OSC values go from 0 to 1, but you can set them to 1 to 0. Same with MIDI using 127.

Re: reverse a value ?

Posted: 01 Dec 2013 20:23
by oran-outan
Thanks


a



LOT...

best
0-0