Routing CC's based on value sent

I’m working on trying to increase the number of useable control buttons on a hardware synth. It has two different buttons for rotary control that send the same CC with different values:

Button 1: Rotary stop - sends CC108 with values 0 for off and 43 for on
Button 2: Rotary Fast/Slow - sends CC108 with values of 43 for slow and 127 for fast

Is it possible with Scripter to route CC108 to different plugin controls based on the values sent?

I don’t quite understand what you’re trying to do.

What exactly do you want to have happen when you receive one of those 3 values? What do you mean by routing CC 108 to different plugin controls and what value would be sent out?
Or are you trying to use those values to control some other CC number?

I think he wants CC108 value of 0 to be off, 43, to be slow and 127 to be fast.

I’m guessing that you are trying to make one knob behave as one of three different CC numbers depending on whether you used the buttons to produce 0, 43 or 127

If that’s the case, then this is trivial to do with GP Script by using a Gig Script as shown below.

In this example, I assume that you can generate 0, 43 or 127 from pushing one of the buttons that produces a CC 108 message.

I’m also assuming then that you have another physical knob that sends out CC 109

With those assumptions, what this GP Script does is to produce a new CC message with CC number 52, 53 or 54 based on whether the last seen value from CC 108 was 0, 43 or 127 respectively. The value of the new message is whatever value came in on CC 109

That new message is injected back into Gig Performer using a local GP port.

Now you can create 3 widgets each one of which will respond to CC number 52, 53 and 54 respectively. You can now map those widgets to whatever parameters of whatever plugins you choose.

With this approach, you can easily route one physical controller to different plugin parameters

The example Gig File is attached here too.


Var
   Max1 : MidiInDevice
   DesiredCCNumber : integer = 52 // Default 
   
On ControlChangeEvent(m : ControlChangeMessage) Matching 108 from Max1
    var
       value : integer = m.GetCCValue()

    select 
       value == 0 do
          DesiredCCNumber = 52
       value == 43 do
          DesiredCCNumber = 53
       value == 108 do
          DesiredCCNumber = 54
    end   
End


On ControlChangeEvent(m : ControlChangeMessage) Matching 109 from Max1
   var
      ccMessage : ControlChangeMessage = MakeControlChangeMessage(DesiredCCNumber, m.GetCCValue())
      
   InjectMidiEvent("Local GP Port", ccMessage)
End   

RerouteCC.gig (48.4 KB)

Oh! Well, in that case I demonstrated how to perform a much more complicated scenario :slight_smile:

Yes, if he wants to control multiple widgets, that would do it.

Steve

Yes, to be clear, in this particular example, I really just need to take CC 108 value 0 and convert it into a different unused CC that I can then map to the plugin. But this will definitely get me going down the proper rabbit hole, so thank you!

Yes but with what value?

There are other ways to do this - it really depends on exactly what you’re trying to do.

For example, in a rackspace, you could have a GPScript callback that would respond to different values of a CC message and set a parameter directly in a plugin

Or you could just use a Scriptlet to modify an incoming CC message with certain values into some other CC message with certain other values and send the new CC message to another plugin directly
(I don’t particularly like this mechanism though, I’d rather map through widgets and use host automation)

Wouldn’t be enough to reinject the CC# 52, 53, 54 with a value in the callback matching 108 and remove the callback matching 109? :thinking:

Reinjecting to Max1 would make it a good candidate for a Gig script if it is wanted…

I don’t know. I have not been able to determine precisely what he actually wants to be generated.

My interpretation of this request is to convert these buttons’ current on/off values into 2 separate CC numbers and convert the sent values into standard toggle values of 0 and 127.

Button 1 Current Desired
CC 108 108
On Value 43 127
Off Value 0 0

Button 2 seems odd as the value for slow is the same as “on” for button 1. So how is GP meant to distinguish from which button value 43 came from? To me this seems impossible to split these into two separate toggling CC messages (but I am tired).

What is unique is value 0 coming from button 1, and value 127 coming from button 2. So perhaps the script could work with this - where value 0 from button 1 becomes value 127, and no off message is sent e.g. both buttons treated as a momentary that only sends 127.

@gboser do the buttons have LED’s or an obvious state where it would be odd for button 1 to be “on” when it is at value 0?

Button 1 is for the rotary brake. 0 is the full stopped position and 43 is slow.

Button 2 is for the rotary speed. 43 is slow and 127 is fast.

In the local off mode, there are leds that flash when you first push them that shows the state, but then they go off.

I think I understood, please @gboser confirm:

Whatever Button 1 and Button 2 initially produce, you would like that:

Button 1 should produce CC108 with value 0 for OFF and CC108 with value 127 for ON
Button 2 should produce CC127 with value 0 for OFF and CC127 with value 127 for ON
(If you don’t like CC127, give us something else)

Is this right ?

Hi,

If you just want to control 2 widgets with the same CC, you might want to try this gig file. It controls the Hanon B70 Leslie and Speed. With just CC 108. The widgets are scaled so that some values control on/off state and other values control speed.

No scripting required.

Leslie-Control.gig (38.9 KB)

Steve

1 Like

Yes, that is pretty much it. It’s gotten a little more complicated because I just realized that the values sent by each button change depending on the combination of the buttons. (The values for the brake on/off are different depending on whether you engage it from the fast or slow speed)

But the basic idea is the same. I would like to specify specific values from CC 108 and convert them to a different CC that can then be assigned to a plugin parameter.

Thank you. Playing with this should consume most of the weekend. :slight_smile:

You keep saying that but you don’t say what values you want the new CC message to send out.

In other words, suppose CC Number 108 with value 43 is sent into gig performer. What CC number do you want to convert it to and what value should be used? Should it still be 43 or did you want it to be a different value? That answer makes a huge difference to choosing the right solution. And do you want to send the new CC message directly into another plugin or are you trying to use host automation?

The specific CC’s on this controller that aren’t assigned to any controls are:

31, 41, 70, 81, 120-127

It would go straight into a plugin parameter. This particular plugin doesn’t care what 2 values get sent, so changing the CC and passing thru the original values would be fine, but it might be better to convert them to a traditional 1-127 on/off configuration.

So the rotary stop button would go from:

108 0-43

30 0-127

OK - this is a critically important point. If you’re just converting one CC to another and changing some values, then you can trivially do this with a GP Scriptlet in the rackspace - you don’t need a specialized Gig Script, etc

In that case, you don’t even need a scriptlet - you can just use the built-in MIDI Filter plugin

1 Like

I still don’t think this is what’s being asked for :slight_smile:

@gboser with this number of replies, you haven’t given us any specifics of what controller you are using, what plugin and what parameters you want to control e.g. I want to press button 1 and control x; I want to press button 2 and control y.

This is critical information to be able to help you. If it’s easier, open GP’s Global MIDI Monitor (Window menu) and step through the combinations of the buttons and paste in a screenshot, and tell us what the order of your button presses were.