Converting note velocity to cc amount

Hello again gigperformer community! Back at you with another issue I’m stuck on, that I could seriously use some help with. I am trying to convert note velocity of incoming midi notes (from a drum pad) into cc value amounts, so that I can assign that velocity to specific parameters (e.g., the higher the velocity, the higher the saturation level of an effect). These drum pad notes are already mapped to parameters of a VST (enso looper). I don’t see any way of accessing the note velocity values to convert them into midi CC amounts. I even tried going through Bome MIDI translator, but since I have already mapped the notes to widgets in gigperformer, GP won’t output those notes to the virtual port. Any guidance or support in figuring this out would be deeply appreciated!

1 Like

Widget grouping?

1 Like

This was something I did a while back. Haven’t tested it recently.

This scriptlet converts note messages into CC messages and then routes them to the Local GP Port.

The use cases I had in mind:

  • Convert note on/off from buttons and pads on midi controllers into CC 127/0 - so you can use widgets in momentary mode.
  • Convert all notes to a single CC and convert the note velocity to the CC value - allowing you to control a widget/parameter based on your playing volume.

The last parameter allows you to manually send out the last converted message, which is useful when you’re using the widget midi learn.

Note to CC to Local GP Port.gpfav (4.3 KB)

2 Likes

Although it sounds like you may be best using a Gig Script. Something like:

// Convert note velocity to CC value
Var
    IAC_Driver_Bus_1 : MidiInDevice  // Create an alias for your controller in the Rig Manager
    CC_NUMBER : Integer = 55  // Change this to the CC number you want to use
    CHANNEL : Integer = 2  // Only convert for notes received on this this channel

//Called when a NoteOn message is received at some MidiIn device
On NoteOnEvent(m : NoteMessage) from IAC_Driver_Bus_1
    // Pass through original note on message
    InjectMidiEventViaRigManager(IAC_Driver_Bus_1, m)
  
    // Convert note velocity to CC value (only notes on the specified chanel)
    If GetChannel(m) == CHANNEL then
        InjectMidiEventViaRigManager(IAC_Driver_Bus_1, WithChannel(MakeControlChangeMessage(CC_NUMBER, GetVelocity(m)), CHANNEL))
    End
End
2 Likes

Wow, amazing!! Yes, this works perfectly. I can’t believe how quickly you came up with this. Is there any way for me to make it only process notes that are coming from channel 2? Apologies if that is a super basic question, I am new to scripting in GP.

Yep. There are script functions for basically anything you want to check for/change when it comes to MIDI messages. I’ve updated the script above.

2 Likes

Heck yes! Works like a charm. Thank you so much. I will be using this on many things to come I am sure.

2 Likes

a very creative idea @nodrog !

1 Like

@nodrog

It will be useful for community members if you attach a gig file of your setup :slight_smile:

2 Likes

Haha, I think it is too much of a hot mess right now, but I would be happy to share and get some feedback when things are more complete!

1 Like

Great. Would be happy to give my feedback :slight_smile:

1 Like

@rank13
Thanks for the example…just getting into it and understanding basic efficiencies; if the callback consumes the event fragments, does that mean using the NoteOnEvent will leave a pass through of the Note Off?

Yes, that’s right.

So you have to explicitly manage the passthru data…in this case there will be note off passing to output for no real reason? Is this best practice?
I have used midiox/vbscript in the early days which was similar to this as a sink (except a lot more raw hehe)…

Sorry…I should prob move this to scripting categorY?

This is passing through the original note on.

If your intention is to convert the note and not pass anything through, then you would be better using the On NoteEvent and then only act on the note on message (there are functions to test what type it is).