I’m having trouble defining a user function in a rig script I’m writing. The script runs great, I decided to add some functionality and I get a syntax error message. The code is included here, the function in question is at the end of the file.
The error is flagged at the first comma in the list of input parameters. The error reads:
Syntax error in “Main”: Line 190, Col 35 - unexpected or unrecognized token ‘,’
No viable alternative at input Function_Set_PX_Routing_Lights( o6,’
Here’s the code - the function is at the very end. Without the last 8 lines the script compiles and works as it should.
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
//$
// DO NOT EDIT THIS SECTION MANUALLY
Var
MPK : MidiInBlock
UMI : MidiInBlock
KSP_In : MidiInBlock
O6_Out : MidiOutBlock
WS_Out : MidiOutBlock
MW_Out : MidiOutBlock
PX_Out : MidiOutBlock
SNW : Widget
SSW : Widget
KSP10_label : Widget
KSP11_label : Widget
KSP12_label : Widget
KSP13_label : Widget
KSP14_label : Widget
PX_Send_O6 : Widget
PX_Send_WS : Widget
PX_Send_MW : Widget
PX_Send_PX : Widget
cc_msg : ControlChangeMessage
pc_msg : ProgramChangeMessage
song_section : Integer = 0
song_number : Integer = 0
KSP10 : Integer = 10
KSP11 : Integer = 11
KSP12 : Integer = 12
KSP13 : Integer = 13
KSP14 : Integer = 14
KSP_channel_in : Integer
PX_keys_to_O6 : Boolean = False
PX_keys_to_WS : Boolean = False
PX_keys_to_MW : Boolean = False
PX_keys_to_Px : Boolean = True
/*
This script will send program changes to each of the (currently) four synths in the rig. The intended
usage is to send the beginning preset/program for each synth at the beginning of a new song.
The change is triggered by note on messages sent by an Akai MPK Mini Mk3. The Mini has 25 keys, the
lowest of which is C3 = 30 (in hex) or 48 decimal. The keyboard can be shifted up 3 octaves - so
there are 25 + 35 “key switches” available - from decimal 48-108. It’s unlikely I’ll need that many
but they are available if needed. Note numbers below decimal 48 might be useful for something later.
Additionally, there are four synths and a Keystep Pro sequencer in the rig:
MPK = Akai MPK Mini Mk3 (sends on MIDI channel 16)
KSP = KeyStep Pro (sends on MIDI channels 10-14)
O6 = Korg OpSix (MIDI channel 1)
WS = Korg WaveState (MIDI channel 2)
MW = Korg ModWave (Midi channel 3)
PX = Sequential Prophet X (MIDI channel 4)
At the current time neither the MPK or KSP receive MIDI.
The program change schemes for each synth are:
MW and WS only accept program change messages 0-63. These 64 programs are stored in the hardware
“Favorites” buttons, A1-A16, B1-B16, C1-C16, D1-D16.
The O6 has a total of 500 available programs, the first 350 of which are factory programs. They
are addressed via Banks 1-6 (zero-based 0-5) and then 0-99 per bank.
The Prophet X has 12 banks: 1-4 are User Banks U1-U4, 5-8 are Factory Banks F1-F4, and third-party
Add-on Banks 9-12 for banks A1-A4. Each bank has 128 presets - so 0-127.
==============================================================================================
*/
// Called automatically after script is loaded. Sets the Song # and Section # to zero in the GUI.
Initialization
SetWidgetLabel( SNW , “0” )
SetWidgetLabel( SSW , “0” )
// Set_PX_Routing_Lights( False, False, False, True )
End
// SONG NUMBER SELECTION:
// Lowest key on MPK Mini if not transposed is #48. Want that to be song #1, then increasing chromatically up
// the keyboard. Each song selection block will send the initial patches for all synths.
// The block will also set the initial KeyStepPro routing for the song. The default is:
//
On NoteOnEvent( nm:NoteMessage) Matching [48…109] From MPK
song_number = GetNoteNumber( nm ) - 47
Select
//=================================================
// Song #1: Klaus
song_number == 1 Do
song_section = 1
SendNowExternal( O6_Out,MakeControlChangeMessage( 32,1 ) ) //O6 preset 146 "Rasp & Static"
SendNowExternal( O6_Out,MakeProgramChangeMessage( 45 ) )
SendNowExternal( WS_Out,MakeProgramChangeMessage( 0 ) ) //WS preset A1 "Alexanderplatz"
SendNowExternal( MW_Out,MakeProgramChangeMessage( 6 ) ) //MW preset A7 "Delicate Dance"
SendNowExternal( PX_Out,MakeControlChangeMessage( 32,7 ) ) //PX preset F4P20 "Booster Base"
SendNowExternal( PX_Out,MakeProgramChangeMessage( 19 ) )
song_section = 1
KSP10 = 10
SetWidgetLabel( KSP10_label, "Drum > BBA" )
KSP11 = 11
SetWidgetLabel( KSP11_label, "Synth 1 > O6" )
KSP12 = 12
SetWidgetLabel( KSP12_label, "Synth 2 > WS" )
KSP13 = 13
SetWidgetLabel( KSP13_label, "Synth 3 > MW" )
KSP14 = 14
SetWidgetLabel( KSP14_label, "Synth 4 > PX" )
SetWidgetLabel( SNW , "1" )
SetWidgetLabel( SSW , "1" )
//=================================================
// Song #2 “Enio”. Note remapping of KSP13 so can have polyrhythmic 15/8 and 9/8 patterns.
song_number == 2 Do
song_section = 1
SendNowExternal( O6_Out,MakeControlChangeMessage( 32,2 ) ) //O6 preset 241 "Mod Saw Lead"
SendNowExternal( O6_Out,MakeProgramChangeMessage( 40 ) )
SendNowExternal( WS_Out,MakeProgramChangeMessage( 0 ) ) //WS preset A1 "Alexanderplatz"
SendNowExternal( MW_Out,MakeProgramChangeMessage( 6 ) ) //MW preset A7 "Delicate Dance"
SendNowExternal( PX_Out,MakeControlChangeMessage( 32,7 ) ) //PX preset F4P42 "NJS"
SendNowExternal( PX_Out,MakeProgramChangeMessage( 41 ) )
song_section = 1
KSP10 = 10
SetWidgetLabel( KSP10_label, "Drum > BBA" )
KSP11 = 11
SetWidgetLabel( KSP11_label, "Synth 1 > O6" )
KSP12 = 12
SetWidgetLabel( KSP12_label, "Synth 2 > WS" )
KSP13 = 14
SetWidgetLabel( KSP13_label, "Synth 3 > PX" )
KSP14 = 14
SetWidgetLabel( KSP14_label, "Synth 4 > PX" )
SetWidgetLabel( SNW , "2" )
SetWidgetLabel( SSW , "1" )
//=================================================
End
End
// SONG SECTION SELECTION:
On NoteOnEvent( nm:NoteMessage ) From UMI
song_section = song_section + 1
SetWidgetLabel( SSW, song_section )
Select
song_number == 1 Do
Select
song_section == 2 Do
End
End
End
// This maps KeyStep Pro messages to the desired synths
On MidiEvent( msg:MidiMessage ) From KSP_In
KSP_channel_in = GetChannel( msg )
Select
KSP_channel_in == 10 Do
SendNow( KSP_In , WithChannel( msg,KSP10 ) )
KSP_channel_in == 11 Do
SendNow( KSP_In , WithChannel( msg,KSP11 ) )
KSP_channel_in == 12 Do
SendNow( KSP_In , WithChannel( msg,KSP12 ) )
KSP_channel_in == 13 Do
SendNow( KSP_In , WithChannel( msg,KSP13 ) )
KSP_channel_in == 14 Do
SendNow( KSP_In , WithChannel( msg,KSP14 ) )
End
End
Function Set_PX_Routing_Lights( o6,ws,mw,px : Boolean ) Autotype
If o6 Then SetWidgetValue( PX_Send_O6, 100.0 ) Else SetWidgetValue( PX_Send_O6, 0.0 ) End
If ws Then SetWidgetValue( PX_Send_WS, 100.0 ) Else SetWidgetValue( PX_Send_WS, 0.0 ) End
If mw Then SetWidgetValue( PX_Send_MW, 100.0 ) Else SetWidgetValue( PX_Send_MW, 0.0 ) End
If px Then SetWidgetValue( PX_Send_PX, 100.0 ) Else SetWidgetValue( PX_Send_PX, 0.0 ) End
End
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^