Scrip Syx Program Change Messages

Friends, I am not a programmer so I would appreciate your help. I want to send Syx messages of program change with the change of value of Widget for what I wrote this code, but it does not work, in what failure?

SCell : MidiOutBlock
PathD_05W : Widget
Menssage : SysexMessage

On WidgetValueChanged(newValue : double) from PathD_05W

 If ParamToMidi(newValue) = 1 then Menssage = F0 41 10 00 25 12 01 00 00 09 73 F7
    SendSysexExternal(SCell, Menssage)
 
ElsIf ParamToMidi(newValue) = 2 then Menssage = F0 41 10 00 25 12 01 00 00 03 79 F7
    SendSysexExternal(SCell, Menssage)

End
End

Hi @GagoC

Im a not sure what this script should do?
Do you want to send Program Change Messages or really SysEx Messages?

??? error - typo “Menssage”

Hello PianoPaul, I need to send Syx messages.
There was an error in the code that wrote the page, thanks for your help

Try, if this is working:

Var
   MOUT    : MidiOutBlock
   KNOB_PC : Widget
   PC      : ProgramChangeMessage

on WidgetValueChanged (newValue : double) from KNOB_PC
 PC = MakeProgramChangeMessageEx(ParamToMidi(newValue), 1) //PC-Number, Channel-Number
 SendNowExternal(MOUT, PC)
end

@GagoC
Think you also need to take a look here:
https://gigperformer.com/docs/Userguide36/gpscriptintro.html

Hello keyman,
I read the information that you quote and so I got to the mentioned code, but as I commented at the beginning, I am not a programmer for what I get lost, thanks anyway for your help

Take this, one KNOB sends PC Messages, the other SYSEX Message:

Var
   MOUT    : MidiOutBlock
   KNOB_PC : Widget
   KNOB_SYS : Widget
   PC      : ProgramChangeMessage
   selectModeMessage : SysexMessage
   SysEx : SysexManager
   SMES  : Integer

on WidgetValueChanged (newValue : double) from KNOB_PC
 PC = MakeProgramChangeMessageEx(ParamToMidi(newValue), 1) //PC-Number, Channel-Number
 
 SendNowExternal(MOUT, PC)
 
end 

on WidgetValueChanged (newValue : double) from KNOB_SYS
 SMES = ParamToMidi(newValue)
 
 if SMES == 1 then
  selectModeMessage = # F0 41 10 00 25 12 01 00 00 09 73 F7
  SM_CreateSysex(SysEx, selectModeMessage) 
  SM_SendMidiOut(SysEx, MOUT) 
 elsif SMES == 2 then
  selectModeMessage = # F0 41 10 00 25 12 01 00 00 03 79 F7
  SM_CreateSysex(SysEx, selectModeMessage) 
  SM_SendMidiOut(SysEx, MOUT) 
 end  
end
1 Like

Wow, it’s working, Thank you very much PianoPaul, GP really is a program monster

1 Like