a bit of context first, in order to learn the basics of GP scripts I have created a simple panel with some buttons to send sysex values to my Juno 106 hardware synth in order to remotely change patches . The juno 106 is expecting sysex in the format C0 vv (vv being the patch number value from 0 to 127 / 0x7F)
I have also checked that sending these sysex messages with the Bome SendSX tool is indeed changing patches on the harrdware.
Here is the GP panel, in order to help understand what I am trying to describe with my terrible English :
Here is my question:
I do not understand how to initialize a SysexMessage. I thought that simply assigning it to a string would do the trick as the compilation went right but it gaves me the following error message when I am simply assigning the “C000” string to the sysex variable at runtime : GPScript Runtime Exception: Invalid sysex: C000
I am pretty sure it is something trivial but I could not figure out yet the mistake I am doing => so I need your help. here is the function script I wrote:
Function EvaluatePatchNumber() Autotype
Var
decimalValue: integer
sysex : SysexMessage
// Update patch name in the display
SetWidgetLabel(PATCH_DISPLAY, ToPatchName())
// calculate pach decimal value based on teh selected GROUP + BANK + PATCH number
decimalValue=groupWeight + (bankWeight - 1) * 8 + (patchWeight - 1)
Print("Value="+decimalValue+ " | hex="+ToUppercase(IntToHexString(decimalValue)))
// the folowing line is compiling but gives runtime error
sysex="C000"
//SM_ChangeValue(sysex, 1, decimalValue)
//Print("sysex="+sysex)
//SendSysexExternal(JUNO106_IN, sysex)
End
Many thanks in advance for our help or any suggestions.
Well, the error message is correct……C000 is not a valid sysex message
Sysex messages always start with F0 and end with F7
All the bytes in between must have values less than hex 80 (i.e., less than 128)
Hex C0 is not less than 128
Hello DHJ
thanks a lof for your answer.
I understand now… sh!it it means that I won’t be able to use GP to send these values to the Juno 106 unfortunately. This is a pity as I mainly purchased GP as I wanted to create some tools to interract with my old good Juno…
It is already a miracle that the Juno is supporting MIDI but as the Roland hardware is suporting these C0xx hexa decimal values via MIDI connection it seems that they are not “real” sysex message but proprietary stuff.
Therfore I have another question while I am here:
Do you know if there is another way then to send any hexa decimal values via MIDI from a GP script please ? (but not as “sysex” then) Thanks
In fact if someone of the GP team is reading this message:
I guess it could greatly impove the scripting developement (especially for newbies like me ) if this kind of error was detected during compile time instead of runtime :
Var
sysex : SysexMessage
sysex="C000" <= this could fail at compile time perhaps
It does fail at compile time. You can’t assign strings directly to a sysex object. In version 4.5 of Gig Performer, you have to use the SM_CreateSysex function or SM_CreateSysexFromString to create a sysex message
Well, I’m not sure we can handle every possible error that someone could make. It seems to me that it’s reasonable to assume anybody who is working directly with MIDI needs to understand the format of MIDI messages so as to know that a program change message is not a sysex message.
More relevantly, in GP Script, it’s not necessary to know anything about MIDI format if all you’re trying to do is send out program change messages. E.g, in a scriptlet you could just write the following and let GPScript take care of the structure of the MIDI message:
var
// Create a program change message for program number 42
pc : ProgramChangeMessage = MakeProgramChangeMessage(42)
Hello @David-san ,
sorry for the delay but I could not found anymore my Juno 106 service manual. I got it with from a friend of mine who was repairing synths in the shop where I purchased my Juno in 1986, it is dated of July 1984 so I guess it is corresponding to my model .
Here is the serial number of my Juno if it can answer to your question:
Hello @dhj ,
sorry to disturb you again but I still not managed to make these simple PC things working. There is something I do not understand in the MIDI input/output logic
Here is my wiring, I got a MIDI IN block called JUNO106_OUT in the script as it is the out port of the JUNO 106 and a MIDI OUT port called JUNO106-IN as it is the MIDI input connector of the juno:
When pressing any preset button in the JUNO it is sending the sysex patch contents to the GP MIDI IN port (JUNO106-OUT) and I can see this incomming data in the GP MIDI IN monitor window:
But in the script when I am using the JUNO106_IN (therfore the GP MidiOutBlock) in the SendNow() function the compilation fails as the SendNow() function strangely expects a MidiInBlock as argument:
How is it possible that we have to SEND something to a GP IN port from where I am RECEIVING sysex values as it is the hardware MIDI OUT connection ?
By the way , when I am using the MIDI IN port (so the JUNO106-OUT) it compiles fine but the JUNO does not react to the sent program changes which is normal to me as we are sending data to the JUNO 106 MIDI IN connector port. And I can see in the same MIDI monitor window displaying the patch values SENT by the JUNO 106 when pressing a patch button on the JUNO the program changes values I am sending … to the JUNO OUTPUT connector/ GP MIDI IN.
I have to say that I do not understand the logic of the SendNow() function if we have to send stuff to an hardware OUTPUT port/ GP MidiInBlock to me it cannot work…
I know you’re interested in learning GPScript but it seems to me that everything you’re trying to do so far can be done without GPScript at all. You could just attach a widget to the PC parameter of a MIDI Out plugin and be done.
Or if you want to use individual buttons, the. Just scale the values and attach to the PC parameter
Hey, I have just used the SendNowToMidiOutDevice(“iRig MIDI 2”, pc) using the MIDI device name / interface where my JUNO is connected and the script is working perfectly now:
I am confirming you that the SendNowExternal(JUNO106_IN, pc) function using logically a MidiOutBlock is working fine as well , the JUNO is well receiving my PCs
Therfore I am wondering even more if there could be a mistake in the SendNow( MidiInBlock, MidiMessage ) function…