Converting Max/LiveAPI parameter value to Ableton Macro mapped min max value

    Nov 09 2019 | 7:32 am
    I have a chain selector mapped to a macro and limited from 1 to 16 using the Ableton macro mapping. I find that in both Max and LiveAPI object properties the macro parameter value reports as a 0..127 value. I want to know which chain is selected when the value changes but I cant work out the conversion from 0..127 value to 1..16 without errors. The errors are when the gui generated value 0..127 falls near a boundary and converts to the wrong chain number. Using javascripts (I had exactly the same problem using Max objects) Math.floor(input/8+1) gives me close but as I mentioned, errors on certain edges. This should be easy and straight forward, right? Am I doing it wrong?