Invert values?
  • Akira
    ultim8 member
    Posts: 388
    Joined: Thu Aug 12, 2004 5:47 pm
    Location: Argentina

    Invert values?

    by Akira » Wed Sep 27, 2006 9:30 pm

    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!
  • Lupin
    garageCube team
    Posts: 383
    Joined: Fri Aug 18, 2006 12:37 pm
    Location: France
    Contact:

    by Lupin » Thu Sep 28, 2006 4:39 pm

    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
    Gael Abegg Gauthey (former known as Lupin)
    https://www.linkedin.com/in/abegg-gauthey/
  • Akira
    ultim8 member
    Posts: 388
    Joined: Thu Aug 12, 2004 5:47 pm
    Location: Argentina

    by Akira » Thu Sep 28, 2006 9:33 pm

    I can tell it's been 8 years since i went out of computer science studies :P

    cheers lupin!!!!!!
  • User avatar
    boris
    garageCube team
    Posts: 911
    Joined: Mon Jun 28, 2004 12:36 am
    Location: Geneva
    Contact:

    by boris » Fri Sep 29, 2006 12:17 am

    Still more simple...

    Code: Select all

    value = 127-value
    Boris * garageCube team

Who is online

Users browsing this forum: No registered users and 17 guests