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.
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)
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:
CC messages from 0 to 127, so GP will not be able to perceive it in any way in relative mode, I think
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
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
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