Multiple values from one encoder

I want to send multiple values from one encoder. For example I have two devices. When I use the pot 0-127, one device receives 0-127, but another device receives only 0-63. So at max value on the encoder (127) one device is receiving 127 the other 63. I have tried to do ‘VAL / 2’ but there is an issue where it sends a 0 message in between steps. Is there another way of doing this?

1 Like

You could define two local variables on the ‘Potmeter’ tab; ‘val1’ and ‘val2’. One is assigned self:potmeter_value() and the next is assigned self:potmeter_value() - 63.

Then just reference the value in the midi_send() section:

1 Like

This doesnt accomplish what im looking for. Because when encoder value is 0-63, the second device will receive a 0 message. What I want: When the encoder is at 64, the second device should receive value 32. When its at 100, it should be at 50. At 127 is should be 64. Half the value. Ideally I could plug any number as a divisible to create a max value. Say I want max value to be 32, then It would be val / 4. If the controller didnt send 0 messages in between you could just use a ‘divided by’ in the parameter 2 location. That way I can program more detail macros. Additionally it would great if you could send the inverse of the encoder value. So at 127, it sends 0. At 100 it sends 27.

There’s definitely ways to achieve this. It’s just a matter of figuring out the math.

There are functions to set ‘min’ and ‘max’ encoder values. I’m a lot more used to just using a ‘Code’ block instead of the visual action blocks. There should be a way forward here.

The functions for min and max are self:potmeter_min() and self:potmeter_max().

You are only wanting to scale one of the output value ranges though. It should just be a matter of where you call those functions (I would think).

im terrible at math and coding. :dotted_line_face:

i can google tho.

math floor rounds integers. I figured it was a rounding issue. Fixes the 0 steps in between. Apparently theres a better way to round in Luna, but this is fine for me.

midi_send(ch, 176, cc, math.floor(val / 2) )