I'm trying to write a script that will send incoming MIDI notes sequentially to 8 separate instruments in a multi. I keep getting errors. I'd be grateful for pointers.
I started by trying with 2 instruments.
Here's my bad script:
on init
declare $currentInstrument := 0
declare $numberOfInstruments := 2 { Assuming 2 instruments in the multi }
end on
on note
$currentInstrument := ($currentInstrument + 1) % $numberOfInstruments
if ($currentInstrument = 0) then
{ Send note to the first instrument in the multi }
play_note(0, $EVENT_NOTE, $EVENT_VELOCITY, -1)
else
{ Send note to the second instrument in the multi }
play_note(1, $EVENT_NOTE, $EVENT_VELOCITY, -1)
end if
ignore_event($EVENT_ID)
end on
Where is this getting screwed up? (Throughout?) I'd be grateful for any thoughts/corrections.