How do I connect a knob to a CC controller using code?
-
How do I connect a knob to a CC controller using code?
-
@CatABC You can use the on controller callback to get the incoming value of the CC and then set the knob's value.
-
@d-healey Thanks a lot for the tip, I succeeded,
Treat you to watermelon, even though it's just an Emoji,But I really mean it.
local number = Message.getControllerNumber(); if (number == 1) { local ccValue = Message.getControllerValue(); Console.print(ccValue); local inputValue = ccValue / 127; Console.print(inputValue); knb1.setValue(inputValue); }
-
@CatABC If you want the knob to represent the actual MIDI values and not a normalized value you can set the "min", "max" and "stepSize" of the knob to reflect that:
knb1.set("min", 0); knb1.set("max", 127); knb1.set("stepSize", 1);
If you do that you would just get rid of of the "inputValue" variable and use the "ccValue" directly to set the knob value.
-
@VirtualVirgin Cool, thanks for your suggestion, it's very useful