I wrote a script intending to achieve a cool result called the “Sustenuto Effect”. My intention is to create the effect of two people playing pianos. Here is how it should work:
-
Play notes from MIDI Block M1 as normal until the sustain pedal is depressed.
-
Then when notes are played and/or held on M1 and the sustain pedal is depressed: latch those notes and do not play any further notes from M1 until the sustain pedal is released. (This is not to be confused with AutoSustainer or Sustain because notes now played from M1 are ignored until you release the sustain pedal.)
-
Now allow notes from M2 to be played but one octave higher. Until the sustain pedal is released.
-
When the Sustain pedal is released:
a. ignore notes played from M2
b. release the M1 notes that were latched
c. activate M1 to normal mode again
The object of the game is: The player would use the sustain pedal frequently to create the effect of another player joining in. The soundscape is very realistic and fun to play … and of course, it can be used with any Source. In my Rackspace, I am using the Stereo Piano from my PC2R, but you can use any source you like.
I will attach a Gig file that includes my script. The script almost works, but not entirely! It needs some help. I am using AllNotesOff to terminate the latch on M1 when the sustain pedal is released, but the AllNotesOff creates a timing issue. Try it and you will see for yourself. Maybe you can think of an alternative method to make the script run more smoothly. Any help would be appreciated.
Here is my script:
Var
M1 : MidiInBlock
M2 : MidiInBlock
FirstTime : Boolean
Sustain : Boolean
TempInt : Integer
CallBack : String
NoteArray : NoteMessage
Initialization
FirstTime = True
Sustain = False
End
On Activate
FirstTime = True
Sustain = False
End
On ControlChangeEvent(m : ControlChangeMessage) Matching 64 from M1
if GetCCValue(m) == 127 then
Sustain := true
else
Sustain := false
end
Select
FirstTime == true And Sustain == false Do
AllNotesOff(M1)
FirstTime == true And Sustain == true Do
FirstTime == false And Sustain == false Do
AllNotesOff(M1)
FirstTime == false And Sustain == true Do
AllNotesOff(M1)
End
End
on NoteEvent(m : NoteMessage) from M1
if Sustain == false then
SendNow(M1, m)
FirstTime := true
else
FirstTime := false
end
end
On NoteOffEvent(m : NoteMessage) from M1
if Sustain == false then
SendNow(M1, m)
end
end
on NoteEvent(m : NoteMessage) from M2
if Sustain == true then
SendNowRespectingParameters(M2, m)
end
end
On NoteOffEvent(m : NoteMessage) from M2
SendNowRespectingParameters(M2, Transpose(m, 0))
end