Modify the velocity based on whether a note is white or black

This script is provided as is - the user will need to have some GPScript understanding so as to understand how change the name of the MidiInDevice or create a new alias for the device in the Rig Manager called Upper for this to work.

In this example, black notes have their velocities increased by 10 and white notes have their velocities increased by 5

const
   // Change these to use different increments
   BlackNoteIncrease : integer = 10
   WhiteNoteIncrease : integer = 5

var
   Upper : MidiInDevice         

   
// Black notes
On NoteEvent(m : NoteMessage) Matching 	
1,3,6,8,10,13,15,18,20,22,25,27,30,32,34,37,39,42,44,46,49,51,54,56,58,61,63,66,
68,70,73,75,78,80,82,85,87,90,92,94,97,99,102,104,106,109,111,114,116,118,121,123,125 from Upper
    
    var newVelocity : integer = GetVelocity(m)
    Print(newVelocity)
    if newVelocity > 0 // Don't touch note off messages
       then newVelocity = newVelocity + BlackNoteIncrease
    end    
    InjectMidiEventViaRigManager(Upper, m.WithVelocity(newVelocity))
End

On NoteEvent(m : NoteMessage) Matching 	
0,2,4,5,7,9,11,12,14,16,17,19,21,23,24,26,28,29,31,33,35,36,38,40,41,43,45,47,48,50,52,53,55,57,59,60,62,64,65,67,69,71,
72,74,76,77,79,81,83,84,86,88,89,91,93,95,96,98,100,101,103,105,107,108,110,112,113,115,117,119,120,122,124,126    from Upper 
    var newVelocity : integer = GetVelocity(m)
    Print(newVelocity)
    if newVelocity > 0 
       then newVelocity = newVelocity + WhiteNoteIncrease
    end    
    InjectMidiEventViaRigManager(Upper, m.WithVelocity(newVelocity))
End


4 Likes

I’m curious: What’s the reason for this Script?

1 Like

There are some controllers where the black keys produce higher velocity values than the white ones.

1 Like

Sure, but why is the velocity of the white keys then increased as well?
…that’s what’s not so clear for me.
Or is it about having a general velocity increase with an additional “plus xy” for the black keys?

There could also be the opposite.
The code of @dhj is just a working example of how to deal with such.

Somebody on Facebook wanted to use budget controllers for some shows in outdoor locations where there was sufficient risk of damage that he didn’t want to use expensive controllers.
He reported that the black keys behaved differently than the white keys with respect to velocity sensitivity and was looking for a fix in GP.

I posted this script as an example for how you could modify velocity using the key color as criteria. The actual modifiers I used were solely for example

I see… thanks for the information. :+1: