Same three CC values for many hardware controls... and Rig Manager

I have a new keyboard controller that I am setting up and… head scratching at the moment because some very odd things seem to be hard coded in this controller in terms of CC values being set out.

This is a multi-part problem.

Most of the controls I care about mapping send unique CC values however, several controls I would like to use send three simultaneous values out (according to GP Midi Monitor) and all these controls in question send the same three values out!

Here’s an example… a foot switch is pressed and GP receives these values:

  1. CC 99 Non-registered parameter (coarse): 1 Channel 1
  2. CC 98 Non-registered parameter (fine): 9 Channel 1
  3. CC 6 Data Entry (coarse): 0-1 Channel 1 (toggles between 0 and 1 values)

Since the first two CC options have static value outputs, meaning no matter how many times i press the foot switch they still produce the same “1 Channel 1”… they wouldn’t help me toggle a switch. I would assume.

Another knob I’d like to use sends this value out:

  1. CC 99 Non-registered parameter (coarse): 2 Channel 1
  2. CC 98 Non-registered parameter (fine): 10 Channel 1
  3. CC 6 Data Entry (coarse): 0-127 Channel 1

Again in this example the first two messages are static and the third is dynamic but as you can see, the third value being sent is the same CC number as the value being transmitted for the foot pedal!

Let’s stop there and ask the obvious first question… is there any way to use any of these controls, even just one of them (the footpedal) without other controls causing chaos?

Second question… with CC 6 outputting values of just 0 and 1… i’m going to have to draw a rather precise graph to make 0< =127, correct?

Third question… with Rig Manager, I am trying to learn an existing midi control alias to the foot pedal but Rig Manager seems to only want to learn CC 98, not CC 6. Is there a way to force a value upon a midi control alias?

Thanks in advance for the insight.

1 Like

You will likely need to get something like Bome MIDI Translator Pro to convert NRPN coming from your keyboard to CC messages to send to Gig Performer.

I can help you with this translation on the Bome Forum.

Steve Caldwell

1 Like

It reminds me of something…

Could it be that you bougth a XK-5? :stuck_out_tongue:

1 Like

yes sir… I found a mint conditioned used one and wow… it’s pretty amazing!

@SteveC-Bome Thank you I registered over on Bome software so I am sure I’ll see you over there.

@David-san I’ll see if this script doesn’t get me someplace as well.

I have never heard of NRPN before but it’s a bit like component streams of data that work in conjunction I gather.

:stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :+1:

Interesting little script @David-san !

Should work.

2 Likes

@David-san you are a genius! That script works like a charm.

2 Likes

@David-san

Would you mind offering a little more guidance on the script… how would I handle multiple instances of this script which define the same CC_msg Matching 99, 98, 6 (since that is a common factor with multiple buttons and encoders) but with different values for those non-registered parameters?

I’ve tried duplicating the script to set up for a second button with unique values but the same CC_msg numbers and I get a Semantic error because the callback range overlaps the previously defined range.

Also, what if this were an encoder vs. a button, how would the setwidgetvalue be applied 1:1 to a range of 0-127?

Thanks for the script you posted… it’s already saved me so much time and angst and taught me some things!

The accepted salutation for @David-san is Sir. :wink:

5 Likes

I am not sure to understand all of your request. Could you give a list of the different 3-CC# sequence you want to use?

Happy to @David-san.

We already know the Leslie Pedal CC information from the XK-5 is as follows:

  1. CC 99 Non-registered parameter (coarse): 1 Channel 1
  2. CC 98 Non-registered parameter (fine): 9 Channel 1
  3. CC 6 Data Entry (coarse): 0-1 Channel 1

So let’s say I wanted to also script a CC number and value from the following data coming from the Percussion Switch:

  1. CC 99 Non-registered parameter (coarse): 1 Channel 1
  2. CC 98 Non-registered parameter (fine): 8 Channel 1
  3. CC 6 Data Entry (coarse): 0-1 Channel 1

And, now also a rotary encoder, the Reverb Knob:

  1. CC 99 Non-registered parameter (coarse): 2 Channel 1
  2. CC 98 Non-registered parameter (fine): 10 Channel 1
  3. CC 6 Data Entry (coarse): 0-127 Channel 1

First question I have is: How to add these to the script because the ‘prefix’ of these values; CC 99, CC98 and CC6, are already declared in the script once and I get a syntax error if I try to overlap the call back range by redeclaring them. Here’s my non-compiling example:

Var
MIDIin : MidiInBlock
speed : Widget
percussion : widget
CC_State : Integer

Initialization

CC_State = 0;
End

On ControlChangeEvent(CC_msg:ControlChangeMessage) Matching 99,98,6 from MIDIin

Select
CC_State == 0 Do
    CC_State = if ((GetCCNumber(CC_msg)==99)And(GetCCValue(CC_msg)==1)) Then 1 Else 0 End

CC_State == 1 Do
    CC_State = if ((GetCCNumber(CC_msg)==98)And(GetCCValue(CC_msg)==9)) Then 2 Else 0 End          
    
CC_State == 2 Do
    if ((GetCCNumber(CC_msg)==6))
    Then
        if (GetCCValue(CC_msg)!=1)
        Then
            speed.SetWidgetValue(100.0);
        Else                
            speed.SetWidgetValue(0.0);
        End
        CC_State = 0;
    End
    End
    
End    

Initialization

CC_State = 0;
End

On ControlChangeEvent(CC_msg:ControlChangeMessage) Matching 99,98,6 from MIDIin

Select
CC_State == 0 Do
    CC_State = if ((GetCCNumber(CC_msg)==99)And(GetCCValue(CC_msg)==1)) Then 1 Else 0 End

CC_State == 1 Do
    CC_State = if ((GetCCNumber(CC_msg)==98)And(GetCCValue(CC_msg)==9)) Then 2 Else 0 End          
    
CC_State == 2 Do
    if ((GetCCNumber(CC_msg)==8))
    Then
        if (GetCCValue(CC_msg)!=1)
        Then
            percussion.SetWidgetValue(100.0);
        Else                
            percussion.SetWidgetValue(0.0);
        End
        CC_State = 0;
    End
    End
    
End    

And the error I get: GLOBAL RACKSPACE (GlobalRackspace) - Semantic error in “Main”: Line 41, Col 61: Callback range overlaps a previously defined callback range

So first question is about how to structure the script so I can add multiple incoming data formulas and map them all to unique CC values and value ranges.

My second question is: what if these were not buttons but instead were rotary encoders?

For instance, in your script you create a widget value based off the binary diference of 1 point of value in the third CC value. It’s either 0 or 1 and that is remapped to widget switch values:

CC_State == 2 Do
    if ((GetCCNumber(CC_msg)==8))
    Then
        if (GetCCValue(CC_msg)!=1)
        Then
            percussion.SetWidgetValue(100.0);
        Else                
            percussion.SetWidgetValue(0.0);
        End
        CC_State = 0;
    End
    End

However, if this were a rotary controller with a 0-127 range and needed to be applied to a widget value in the same 0-127 range… it’s no longer an if Then Else type of argument, correct? I’m not sure how to define this properly to a ‘knob widget’.

Thank you!

Those are not “prefixes” — they are CC numbers. It would make absolutely no sense to allow the same CC numbers to match multiple callbacks. How would the system know which one to call — the same CC numbers are invoked every time. Of course they can’t be redeclared.

As for the actual code: it’s clearly going to look something like this (pseudo-code approximation)

   select
        CC_State == 0 do
           if GetCCNumber(CC_Msg) == 99
             then
                firstParam = GetCCValue(CC_Msg)
                CC_State = 1
             else CC_State = 0
           end

      CC_State == 1  do
         if GetCCNumber(CC_Msg) == 98
            then
                secondParam = GetCCValue(CC_Msg)
                CC_State = 1
             else CC_State = 0
           end

    CC_State == 2 do
         // Do whatever you want here based on the possible values
         // of firstParm and secondParam

        CC_State = 0
   end
1 Like

Yes, this is exactly the way to go. I won’t sit much today, and my day will end quite late, but if this is not enough for @brandon, I will produce a complete piece of code with this (hopefully) tonight.

@David-san

I’m afraid I don’t have enough to go on to make this work on my own, but I am not in a rush about it, I have from your first script a working solution for the most important button on the XK.

I just would like to have a complete script for three controls, two buttons and one rotary encoder so I can see how you’d handle multiple instances of the CC# 99, 98, 6 and also see how you would handle the difference between a button and a rotary encoder.

From that I should be able to replicate a script that controls all 12 surface controls.

Whenever you get the time, many thanks.

CC_State == 2 do
         // Do whatever you want here based on the possible values
         // of firstParm and secondParam

   if GetCCNumber(CC_msg)==6)
      then
         select

            firstParam == 1 and secondParam == 9 do
                LesliePedal(GetCCValue(CC_Msg))


            firstParam ==1 and secondParam == 8 do
                WhatEverFunctionWantsOneAndEight(GetCCValue(CC_Msg))    

            firstParam ==3 and secondParam == 14 do
                WhateverFunctionWantsThreeAndEight(GetCCValue(CC_Msg))    


        end        
    end
    CC_State = 0 // Reset the state when you're done
    

Now just write a bunch of functions to implement whatever is supposed to happen when those particular sequences of CC messages show up

@brandon, this is a Gig script you could use to convert CC99+CC98+CC6 into a single CC# which could be used like any other single CC#. e.g. you could MIDI learn a widget with it. I couldn’t test if it works, but it should be close to. Using a gig script GP should even not notice that your controller is sending CC99+CC98+CC6, only the single CC# will enter GP.

Var
  XK5                        : MidiInDeviceAlias // Define XK5 as a RigManager alias to the real controller
  CC_State, CC99, CC98       : Integer = 0;  

On ControlChangeEvent(CC_msg:ControlChangeMessage) Matching 99,98,6 from XK5
    Select
      CC_State == 0 Do if (CC_msg.GetCCNumber()==99) Then CC99 = CC_msg.GetCCValue(); CC_State = 1 Else CC_State = 0 End
                       
      CC_State == 1 Do if (CC_msg.GetCCNumber()==98) Then CC98 = CC_msg.GetCCValue(); CC_State = 2 Else CC_State = 0 End
    
      CC_State == 2 Do
        if (CC_msg.GetCCNumber()==6)
        then
          Select
            // Leslie Pedal => CC#20
            CC99 == 1  && CC98 == 9  Do InjectMidiEventViaRigManager(XK5, MakeControlChangeMessageEx(20, CC_msg.GetCCValue()*127, 1));

            // Percussion Switch => CC#21                            
            CC99 == 1  && CC98 == 8  Do InjectMidiEventViaRigManager(XK5, MakeControlChangeMessageEx(21, CC_msg.GetCCValue()*127, 1));
            
            // Reverb => CC#22
            CC99 == 2  && CC98 == 10 Do InjectMidiEventViaRigManager(XK5, MakeControlChangeMessageEx(22, CC_msg.GetCCValue(), 1));
          End  
        end
        CC_State = 0; 
     End
End

Please, tell me if it works for you.

2 Likes

That’s a great solution

1 Like

thanks @David-san and @dhj … looking forward to trying this out… will probably be the weekend before I can.

cheers.

The magic of the Gig script you invented :wink:

1 Like