Learning to build my first scriplet in GPScript

As a novice keyboard player in an area where keyboard players are a premium rarity, I get to play with bands that demand much more of me than I am capable of delivering. I have a vocalist qualified to play chop sticks.

Using a scriplet, I have been able to leverage him as a third hand on the keyboards. He has a ~$100 Arturia MINI-LAB (2 octaves) and it is plugged into my system via Bluetooth WIDI. Here’s how its done.

In the rackspace wiring diagram for the song, right click to open a menu to insert a widget.

Select “Scriplet”.

I renamed it to display “Chord Enhancer”. For my purposes, I is important that I have a midi control block that prevents him from sending anything other than notes. No control messages enter my system from his keyboard when this rackspace is active.

Double clicking the scriplet widget opens a window, clicking the edit icon
image
opens the scriptlet editor. Here is the script I use.

“Initialization” is not required. For my needs, I wanted to have my chops sticks efficienado play one note which results in chords. This requires that I capture and process “NoteEvent”s. In the parenthesis is a parameter that is passed from GP to my scriptlet. “: NoteMessage” is the type of variable being passed. This declaration must be included and it must be a type GPScript will accept. “m” is my variable which represents the note being passed.

Since this scriplet is “wired” to a midi device, there is no need to declare a midi in block as noted in other samples which are for global and song scripts. Any note played on any midi device wired to the input of the script block will be passed to this function.

Things like “B3” are defined within GP as numeric variables. You can use these to directly compare the note passed in by GetNoteNumber(m) as they are of compatible types. If one of the 4 notes allowed is played, I will pass that same note back to GP to be played.

I would typically have and “else” in my “if” statement that would always pass that note back and not have to include it elsewhere in the “if” statement. However, I don’t want keys that get bumped accidentally in this case to get played.

For each acceptable note passed in, I generate two additional notes to form the desired chord. GPScript is NOT object oriented. The “NoteMessage” m does not have properties you can access in an object oriented manner. You must call functions which will return the desired properties of that variable. To make a “NoteMessage” to pass back to GP, the note number, velocity and channel are required.

Once the scriplet is wired in properly, my third hand is able to add notes that I simply do not have enough fingers to play. While my need for a third hand may not be important to most keyboard players, the intent of this is to provide a walkthrough for creating your first scriplet.

3 Likes

Welcome to the GPScripter community :wink: :+1:

Hopefully you didn’t name your Scriptlet « Chord Maker » :stuck_out_tongue_winking_eye:

1 Like