So I am new potential user here, just playing around with 14 day trial. I whipped together a quick little test of midi sequence playback in GPScript…just a proof of concept…want to see if I am on the wrong track or anyone has done anything already…or tips about GPScript that might apply…
Here is simple little example, this just sends two NoteOn’s on beat one and two just to see how to schedule notes for playback, but theoretically, it could be expanded to hundreds or thousands of events, actually what I would ultimately do is write a separate program outside of GigaPerformer that basically will generate the script from a midi file.
Theoretically this will work fine as this demonstration shows…
But a couple questions
-
Is there any reason I couldn’t call ScheduleMidiEvent and queue up 1000 events during Initialization and expect them to playback? Any limit to any many midi events can be queued up ahead of time?
-
If the playback is stopped and restarted, is the internal queue also reset?
-
Looks like currently GPScript does not have any kind of struct to hold related data in an array of structs or something like that… Am I missing anything?
There are some further optimizations that can be done, but just quick proof of concept it more or less works to schedule midi events, then its just matter of doing that once per beat (unless it can be done just a single time before hitting PLAY.
var iRig : MidiInBlock
var a : MidiMessage[5]
var t : Double[5]
var b : Integer[5]
var idx : Integer
Initialization
b[0]=0;t[0]=0;a[0] := MakeNoteMessageEx(60,100,1)
b[1]=0;t[1]=0;a[1] := MakeNoteMessageEx(62,100,1)
b[2]=0;t[2]=0;a[2] := MakeNoteMessageEx(64,100,1)
b[3]=3;t[3]=0;a[3] := MakeNoteMessageEx(66,100,1)
b[4]=4;t[4]=0;a[4] := MakeNoteMessageEx(68,100,1)
idx := 0
End
On BeatChanged(barNumber : Integer, BeatNumber : Integer, tick : Integer)
if( BeatNumber >= b[idx] ) Then
while b[idx] <= BeatNumber Do
ScheduleMidiEvent(iRig, a[idx], t[idx])
idx := idx + 1
End
End
End