Constructing Sysex Messages for X Touch Scribble Strips

Hello my friends,

I am attempting to develop a script that sends a string to the LCDs on my Behringer X Touch.

These threads/articles gave me a lot of good information to get started:

https://gigperformer.com/controlling-the-rjm-gt-mastermind-from-gig-performer/

Still, I need a little help reaching the finish line.

Here is my script:

var
    MCUPrefix : string = "F0000066141200"  
    MCU : MidiOutBlock
    
    
// Construct a complete sysex message

function MakeMCULabelSysexMessage(LCDLabel : string) returns String
    var

        LCD : string = StringToHexString(LCDLabel)
        
    result = MCUPrefix + LCD + "F7"
end

function SendToMCU(LCDLabel : string)
    var
        SysEx : SysexMessage = MakeMCULabelSysexMessage(LCDLabel)
        SendSysexExternal(MCU : midioutblock, SysEx : sysexmessage)
End

Initialization 
    
    SendToMCU("12345601234560123456012345601234560123456012345601234560")
    
End

Also, I wrote out the script for the “Mastermind GT MMGT Input” for practice. If anyone would like to use it for a starting point for a similar project, here it is:

var
    RJMPrefix : string = "F000015B001D00"  
    midiDeviceName : string = "Mastermind GT MMGT Input"
    
// Construct a complete sysex message
function MakeRJMLabelSysexMessage(pageNumber : integer, buttonNumber : integer, color : integer, buttonLabel : string) returns String
    var
        pp : string = IntToHexString(pageNumber)
        bb : string = IntToHexString(buttonNumber)
        cc : string = IntToHexString(color)
        text : string = StringToHexString(buttonLabel)
    
    result = RJMPrefix + pp + bb + cc + text + "F7"
end

function RJMSendTitle(title : string)
    var
        sysexString : String = MakeRJMLabelSysexMessage(0x7f, 0, 0, title)
        SendSysexNowToMidiOutDevice(midiDeviceName, sysexString)
end

// Set the label text and color of the specified button
function SendToRJM(buttonNumber : integer, color : integer, buttonLabel : string) 
    var
        sysexString : String = MakeRJMLabelSysexMessage(0, buttonNumber, color, buttonLabel)
        SendSysexNowToMidiOutDevice(midiDeviceName, sysexString)
end

Initialization 
    
    RJMSendTitle("Reelin' Gig")
    
    SendToRJM(0,5,"Tap")
    
    SendToRJM(3,1,"Panic")
    
End

//iterate though song parts and create sysex messages
//and send out sysex messages
Function SendSongPartsToPedal()
    var count : integer = GetSongPartCount()
    
    i : integer
    partname : string
    myMidiMessage : MidiMessage
    sysexString : String
    firstPartButtonIndex : integer = 4
    maxParts : integer = 6
    buttonColor : integer
    
    for i = 0; i < maxParts; i = i + 1 do
            if i < count
                then
                    partname = GetSongPartName(i)
                else
                    partname = " "
    end

        //now send the part name
        SendToRJM(i + firstPartButtonIndex, buttonColor, partname)
    end
    
end

// called when you switch to another song
On Song(oldSongIndex : integer, newSongIndex : integer)
    var
        songname : String = GetSongName(newSongIndex)
        
        RJMSendTitle(songname)  // Update the song name in center large panel
        SendSongPartsToPedal()  // Send the song parts to individual buttons
        
End

Lastly, for any Touch users that are looking to gain greater control over their unit, I found this Midi Implementation online and it’s been invaluable. Enjoy!

Xctl Protocol for X-Touch V1.0.pdf (442.4 KB)

As always, thanks for your help!
Sam

What help do you need?

1 Like

I’m having trouble getting the script to compile. I get a syntax error with:

SendSysexExternal(MCU : midioutblock, SysEx : sysexmessage)

“Unexpected or unrecognized token: ‘SendSysexExternal’
Mismatched input ‘SendSysexExternal’ expecting End”

That is a completely insufficient amount of script to be able to see what’s wrong.

My entire script is in my first entry. Line 21 has the syntax error.

Or did I misunderstand?

I see. The problem is that your function call should just include arguments, not “type” information.

I.e, rather than

SendSysexExternal(MCU : midioutblock, SysEx : sysexmessage)

you should be writing

SendSysexExternal(MCU, SysEx)

You might want to review how functions are defined vs how they are invoked

Excellent! Thank you! Seeing words leap onto my X Touch makes me so happy! Future development of this script will harvest widget labels for LCDs on a Rackspace by Rackspace basis. I’ll update the thread with the results. Thanks again!

Sam

1 Like