Page 1 of 1

Invert values?

Posted: Wed Sep 27, 2006 9:30 pm
by Akira
Hey module freaks ;)

I want to do a module that takes input from a MIDI signal and outputs it in inverse fashion to a modul8 parameter.

I mean, if I go from 0 to 127 in my knob, it has to send 127 to 0 to the parameter (reverse order)

I guess it can be done through the interface, and not straight with the MIDI values!

what's the algorithm to invert the values like this? I would like NOT to do a huuuuuuuuuuuuuuuuuuge comparison table :?

Cheers!

Posted: Thu Sep 28, 2006 4:39 pm
by Lupin
i consider your input value as a variable named valueIn
here is the algorythm you can use

Code: Select all

newValue = abs(127 - valueIn)


that simple :)
enjoy

Posted: Thu Sep 28, 2006 9:33 pm
by Akira
I can tell it's been 8 years since i went out of computer science studies :P

cheers lupin!!!!!!

Posted: Fri Sep 29, 2006 12:17 am
by boris
Still more simple...

Code: Select all

value = 127-value