NRPM and My AKAI Professional MPK49

Define MPK49 as a Rig Manager alias to the real controller. Copy, paste and compile this code in the Gig script editor:

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

On ControlChangeEvent(CC_msg:ControlChangeMessage) Matching 99,98,97,96 from MPK49
    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
          Select
            CC_msg.GetCCNumber()==96 Do CC96 = CC_msg.GetCCValue();
            
            CC_msg.GetCCNumber()==97 Do CC97 = CC_msg.GetCCValue();                    
          End
          
          Select
            // Knob#1 increment redirected to CC#20
            CC99 == 100  && CC98 == 105 && CC96 == 1 Do InjectMidiEventViaRigManager(MPK49, MakeControlChangeMessageEx(20, 64+CC_msg.GetCCValue(), CC_msg.GetChannel()));

            // Knob#1 decrement redirected to CC#20
            CC99 == 100  && CC98 == 105 && CC97 == 1 Do InjectMidiEventViaRigManager(MPK49, MakeControlChangeMessageEx(20, 64-CC_msg.GetCCValue(), CC_msg.GetChannel()));         
          End  
          CC_State = 0; CC96 = -1 ; CC97 = -1;
     End
End

If you turn your NRPN nob this should produce a Relative Offset compatible CC#20 message (hoping it is unused by you MPK49). You will also have to set the Relative Offset option in the MIDI tab of your widget properties for the widget you will use with it.

Tell me if it works for you. I don’t own a MPK49 and couldn’t test it for you. Then if you tell me more about the MIDI messages produced by the other knobs I could adapt the script a bit.

As I showed above, 5 commands are sent with each knob move. Script does not accept the values 100 and 105 from CC99 and CC98, perhaps because they come almost instantly. the Print operation (line 12) always shows the value 127 as a last in the logger.
image
image
I think focusing only on CC96 and CC97 can make this work, but since the CC98 and CC99 values are assigned in the AKAI settings, this will work for a maximum of 1 encoder… If there is no way to intercept the first 2 values CC98 and CC99 (100, 105)

Could you please post a screenshot the GP global MIDI monitor when you move the knob?

increasing it:
image
decreasing:
image

With script I have this one:
image
image

The value after the very first movement does not change anymore

Could you please post your gig file?

file 1.gig (36.3 KB)

Could you please test this?:

MPK49_NRPN_test.gig (28.4 KB)

Is the code the same? Does not work

What exactly does not work?

What happens now in the global MIDI monitor?

Did you use the relative coding at the Rig Manager level ? (If yes remove it at the widget properties level).

I have already written that the script does not catch the first two values of CC98 and CC99 in this case:

AKAI encoders can send messages in two modes:

  1. CC messages from 0 to 127, so GP will not be able to perceive it in any way in relative mode, I think
  2. NRPN messages that are used to send an offset rather than a relative value. Therefore, the script does not work correctly further. I think, for proper operation, it is worth considering only the CC96 and CC97 values in order to make at least one encoder work
    https://youtu.be/XxJTyXowrqI this video explains how NRPN should work

No answer to my questions ?

  1. I kind of tried to explain
  2. Midi monitor: only one CC20: 63 or 65 ch 1
  3. I’ve already tried all the ways, I think

Could you please confirm that you used the last gig file I posted and that the Gig script was strictly copied from the script I posted?

I tested by generating a simili MPK49 NRPN coding and it worked…

Yes, I’m sure

Var
  MPK49    : MidiInDeviceAlias // Define MPK49 as a RigManager alias to the real controller
  Val      : Integer;


On ControlChangeEvent(MSG:ControlChangeMessage) Matching 97,96,98,99 from MPK49
Print(MSG);    
    Select     
        MSG.GetCCNumber() == 96 Do
            Val = Val + 1;
            InjectMidiEventViaRigManager(MPK49, MakeControlChangeMessageEx(20, Val, MSG.GetChannel()));
            Print(Val)   
        MSG.GetCCNumber() == 97 Do
            Val = Val - 1;
            InjectMidiEventViaRigManager(MPK49, MakeControlChangeMessageEx(20, Val, MSG.GetChannel()));
            Print(Val);
    End 
End

Okay, finally I wrote something that works for me, which works with a long delay, but, ironically, I invented a regular controller. I found actions on widgets in the GPScript programming language, for example, GetWidgetValue and SetWidgetValue, thanks to which you can interact with widgets at once, but I did not find a way to do this through CC messages. I think this case will be developed

If you remove all the print commands, it will most probably run faster.

Congrats!

I simulated the MK49 NRPN in a Scriptlet to test the gig file with the Gig Script I posted previously. It works perfectly:

MPK49_NRPN_test.gig (28.4 KB)

NRPN_MP49

Yes! I was able to make it work, thanks! I don’t know why it didn’t work yesterday, but everything is fine now

1 Like

Finally, great! This solves the problem for one knob and if you tell us more about the NRPN generated by the other knobs, the GigScript could be extended.

For other knobs, I can use different midi channels, but in fact it works due to the CC98 and CC99 values, synthesizers (maybe plugins too) calculate the necessary parameter using these values. Look at the photo


But this concerns exactly the values of the synthesizer, every synthesizer should have a similar midi table, as I understood. How to apply this in GP4 I do not know. That’s all I know