Reversing Sensor Data
I want to use incoming pot data to decrease gain on one channel and increase gain on the other. How would I do this? I tried an inverse scale, but that didn’t seem to work. Any thoughts?
I’m not sure how this would work. I’m trying to take serial data received from a potentiometer.
could you show some of your data then? Otherwise we’ll just be guessing, really.
The data that is feeding in is a number in a range from 0 – 1023 which is converted from voltage. I run the data into Arduino2Max through an Analog input then out to my gain sliders. Hope that helps.
if you just want a simple linear relationship use "expr 1023 – $i1"
----------begin_max5_patcher---------- 470.3oc0V00SCBCE8Y3WA13iaFZGvX9l+NLlkBT2pAJjRQQW1+caukM27qw1 LnFRfzaubtmd3bKckqCJorkUi7t16VOGmUtNNPHS.mtwNnBZaZNsFRCIZJRX RzH6T2WJT07WXlovjq76BW1nxYJ0yULKzHtPgF4gRnhEHu65xRCEWnyC.F2E rhpRWxEKlKYoJ6aGPlnQ1iDDZdD5CCz22EHaEAjHcQ4Y.gKSdX7rc4qfV.zB cijSyQaqqTGWwjyYBZRNjguYp0ttlaiNI8QOEuno.Vf9jICopQlFXDJbj+Qo ZZv2vX+OJjSGPgj8jthaPUwZg0E5hwfRdJFvOWBIG13gAkLL9.RH9i5U72nW ms4ZHsQmQyWzutmoNkly.aimu95T7OegvEcXgyZdvjoGu6I3eu6AGhOS2yje c2CqsRZMOiuji+gLN8PyrFmYgGuugzOeC.HJmKd+I..RYhuuXUW1HS2rt5pi 2azJiUq3BphWJ1ImI6kyRdVFSr6OWx30luYYe8Gs9xlfdvlnAiMw8fMyFL1L sGrI9OEaB9SwFxIxFaKFsp5QlrtCRfH5cddnTt8WHlicYGBsyHI6Q9l7gSMh nR89DJ8lDMRa6babjtYVWm0tu9+P11O -----------end_max5_patcher-----------
[!- 1023] is faster than both scale and expr.
Just used the (!-) object and it worked great. I ended up scaling the data numbers down to the max number I set for my various gains so the action went smoother from my perspective. Seemed to work great, thank you.
Note you’ll have a dip in volume in the middle; that’s the reason why I recommended m4l.bal1~ – it does a proper mix between the two.
I still think it’s the best approach, hehe.