My first "Useful" Script!

I’m very excited that I’ve written my first “useful” script that provides a real solution to something from scratch. I’ve been meaning to dive into scripting with GP for awhile but I’ve focused for the most part on ‘stock’ functionality. In this case, stock functionality would not do the job, so I decided to try to script my way out and it worked!

Problem Domain: I play rhythm guitar in my band on 5-10 songs per night dependent on that night’s set list. There have been multiple occasions where I’ve wanted a set of midi pedals to play an extra part with my feet while my hands are not free. When I was using Forte, I considered buying Bome Midi Translator so that I could translate hold pedal events into a note (like a single pedal) while playing guitar to add a little something to a given song.

We’re learning “Life in the Fast Lane” by The Eagles which has more than two guitar players. Towards the end of the song, there is a section where they play a sequence of four power chords that are ‘flanged’ but there are at least two other guitar parts playing as well. So here I am thinking, wouldn’t it be cool to play the power chords via sampled guitar with my foot while playing one of the other guitar parts on the guitar with my hands?

With GP Script, this is possible using a single hold pedal. So I came up with the following script, and IT WORKS!

var RD : widget // hold pedal widget named 'RD'
var X7In : MidiInBlock // MidiIn block named X7In
var noteArray : Int[4] // Integer Array to hold sequence of note values
var rootNote : Int // the initial note to start on
var currentIndex : Int // current array index

Initialization

	rootNote = 64 // E2

	noteArray[0] = rootNote
	noteArray[1] = rootNote - 2
	noteArray[2] = rootNote - 4
	noteArray[3] = rootNote - 7
	
	currentIndex = 0

End



On WidgetValueChanged(newValue : double) from RD
	var note : NoteMessage
	
	If newValue > 0.6 Then
		note = MakeNoteMessageEx(noteArray[currentIndex], 120, 1) 
		SendNow(X7In, note)
	Else
		note = MakeNoteMessageEx(noteArray[currentIndex], 0, 1)
		SendNow(X7In, note)
		If currentIndex < 3 Then
			currentIndex = currentIndex + 1
		Else
			currentIndex = 0
		End
	End
		 
End

One thing I always stress to people about GP is what a great midi processor it is even if you didn’t host a single VST in it. It is not uncommon for me to use GP as a midi processor from my Kronos back into my Kronos for certain note ranges/transpositions/etc… in order to play things one handed that would normally take two to three hands to play. After writing this script, I can see a bunch of new possibilities I had not considered.

My next script will be to essentially create a midi note latch feature for another song I’m working on.

GP ROCKS!

X

8 Likes

Congratulation for your first script! :+1:

Thanks for sharing! Its great when a plan comes together :wink:
Can´t wait to see your “note latch” implementation!

Maybe this helps:

Sustain note until other note is played