How would I change notes with a Scriptlet

If the chord played is “F-A-C-Eb”, how would I change the notes to be “F-Eb-A-D-G” but an octave lower? I am a little lost on the GPscript commands I would use to do this.

You play 4 notes and want to hear 5?

yes. I want to play on open chord

Did you search for some VST plugins which can reharmonize?

I did and found the Auto-Triad Scriptlet, but that is way over my head. LOL!

I tried going through it but get very confused.

What do you want is not trivial, therefore the code is not easy :wink:

And here is a VST, maybe that helps:


OK. If you could just point me in the right direction with a few commands I might use, I will do the hard work. I don’t expect you to write the Scriptlet for me.

I’ll give it a try. Thanks

Here is a small code

   MIN : MidiInBlock

//Called when a NoteOn or NoteOff message is received at some MidiIn block
//Note: this will NOT be called for NoteOn/NoteOff messages if you have explicit
//NoteOnEvent/NoteOffEvent respectively callbacks defined

On NoteEvent(m : NoteMessage) from MIN
 if GetNoteNumber(m) == F3 then
  SendNow(MIN, m)
  SendNow(MIN, WithTranspose(m, -2)  //Eb3
  SendNow(MIN, WithTranspose(m, 4)   // A3

You have to give the MIDI In plugin a so called GP Script Handle in this case I named it MIN

I have already done this, but this doesn’t do what I want to do.

I have to look at the interval between notes to determine that it is a basic F7th chord let’s say. The function GetNoteNumber only lets me look at one note.

as I said, not trivial

1 Like

… but how do I access all the notes in the chord that was played using GPscript?

I did come across a function which determines the root note of a chord which is very useful to me.

I don’t want to discourage you, but it seems that you already have issues regarding scripting for note management (see NoteTrackers in the GP scripting documentation for this) and as @pianopaul mentioned, you will probably be faced to difficult algorithmic questions to do what you want. Do you really want to go this direction? :grimacing:

1 Like

I tried this script:

xArray : Integer Array
nt : NoteTracker

On NoteOnEvent(m : NoteMessage)
xArray = NoteTracker_GetHeldNotes (nt)
Print(xArray[0] + xArray[0])

… but I get the following error:
“Scriptlet (Scriptlet) - Array index out of bounds: index (zero-based) = 0: Current array length = 0”

Isn’t “NoteTracker_GetHeldNotes (nt)” supposed to return an array containing the note values that were depressed?


If you use a NoteOn callback you also need a NoteOff callback.
Your NoteTracker is empty, you need to store notes using GotNote functions.

1 Like

This presumes the array is not empty!

I read the section on NoteTracker and I still don’t understand the related functions!

Please tell me my misunderstanding:

On NoteOnEvent(m : NoteMessage)
NoteTracker_GotNote (nt, m)

should be placing all the notes in the chord I just played into nt, but it doesn’t. When I say Print(n) is just tells me the count of the notes played, not the all notes that were played?

Also, the function NoteTracker_GotNoteOn(nt: NoteTracker , noteNumber: Integer ) wants me to provide an integer value for a note. I need to know what notes were just played?