Knob : how to send a CC when its value increases, and another CC when its value decreases?

Hello,

I want to have a knob to send one CC while turning clockwise, and another CC while turning counter clockwise.

How to script this ?

Thank you

Hello,

You first have to change the range of the knob going counterclockwise so you would have something like:

Range property of knob_1 (The knob going clockwise):

{
"min": 0,
"max": 127
}

Range property of knob _2 (The knob going counterclockwise)

{
"min": 127,
"max": 0
}

Then you will have to link the two knobs by using the linkId property as follow:
on knob_1:

@{>>knobturning}

on knob_2:

@{<<knobturning}

Hope that helps !

Swayrian

I'm don't think that exactly what @Sylvain asked for. This is something that can be handled with the script property:

// if the knob was moved before
// (we need something to compare)
if (locals.previousValue !== undefined) {
  // compare old value to current value
  if (locals.previousValue > value) {
    send('/control', 1, 50, 127) // channel 1, cc 51, val 127
  } else if (locals.previousValue < value) {
    send('/control', 1, 51, 127)
  }
}
// update old value
locals.previousValue = value

Doing this with an encoder instead of a knob would be more straightforward:

  if (value == -1) {
    send('/control', 1, 50, 127) // channel 1, cc 51, val 127
  } else if (value == 1) {
    send('/control', 1, 51, 127)
  }
1 Like

Thank you Swayrian.

As jean-emmanuel said, i want just one single knob to send two differents CC.

But it'll help for sure, because now i want to have a look at this "linkID" thing :wink:

1 Like

Merci Jean Emmanuel !

Ah yes, I see your point now @Sylvain ! :sweat_smile:

Glad you found the solution, I actually learnt something thanks to the script above provided by @jean-emmanuel so thank you all for raising the topic :grinning:

linkId is a pretty cool thing, highly recommend to have fun with it !

Swayrian