OSC listener on MIDI sysex messages

Hi,

So I want to listen to a /sysex message that I send with my device.
At the moment I'm able to listen to "normal" MIDI events such as a /control message for that I configure the widgets this way (assuming I use 1 widget to send MIDI control messages and other widget (text widget) for listening to it).

Sending value knob

            "id": "knob_2",
(...)
            "range": {
              "min": 0,
              "max": 127
(...)
            "address": "/control",
            "preArgs": [
              9,
              14
            ],
(...)
            "target": "midi:virtual-launchcontrolxl",
(...)

Listening text Widget

            "id": "text2",
(...)
            "value": "OSC{/control , noidea}",
(...)
            "address": "/control",
            "preArgs": [
              9,
              14
            ],
            "target": "midi:virtual-launchcontrolxl",
(...)

This text widget will show "noidea" when the device is initiated , and as soon as I move the knob it will start displaying the knobs value. So for this good :+1:

Now I'm trying to , by analogy, achieve the same but with sysex messages which in turn have no MIDI Channel assigned or value (the typology of them as you know are not defined)
So I want an event to listen to the incoming sysex then filter them by doing some JS magic . But I'm not able to retrieve them with the following syntax:

  • Asumming I have (2 widgets : 1 Button sending Sysex , 1 Text listening to them)

Button widget

            "id": "buttonA",
(...)
            "target": "midi:virtual-launchcontrolxl",
(...)
            "script": "send(\"/sysex\", \"f0 00 20 29 02 11 77 00 f7\")"
(...)

Its been checked and It does send those sysex

Text widget

            "id": "text1",
(...)
            "value": "OSC{/sysex , noidea}",
            "default": "",
            "linkId": "",
            "address": "auto",
            "preArgs": "",
            "target": "midi:virtual-launchcontrolxl",
            "script": "",
            "vertical": false,
            "wrap": false,
            "align": "center",

I may be commiting a mistake , if anyone is able to see that please let me know.

Thanks very much :pray:

Did you add the sysex parameter to the server's midi config ? Without it, incoming sysex messages are ignored.

1 Like

Parsing sysex can be tedious, using a custom module is much better (once you've extracted the relevant data from the sysex you can dispatch it to the widgets).

1 Like

image

1 Like

Sweet this is working now!! I have missed that part on the Documentation , thanks a lot guys :muscle:

cool !
Do you use a custom module as @jean-emmanuel suggested ?
May i invite you to publish your json session file to help the community ? Me first :wink:
Cheers

1 Like

I would so much want to collaborate, I'm checking the custom-module section, and see if I am able to contribute for sure, I'm gonna take a look if I can really do something worth and if I can surely I will contribute :smiley:

Ok , so I have been some months away unfortunately I had tendinitis and couldn't type on the keyboard properly. But now I'm back like Rocky Balboa
I have jumped into your custom-module page and to be honest at the begining I was overwhelmed but it is approacheable after all.

What I need to do is basically the device to be listening to this certain /sysex message that the DAW sends to the device in order for the device to reply back

Its like an aknowledging protocol which have many MIDI devices in different forms in which the DAW sends a sysex and the MIDI device straightaway replies with a sort of a signature .

So , DAW send to device : f0 7e 00 06 01 f7

And Device responds with: f0 47 00 31 60 00 04 41 0A 01 12 f7

So I have re-written one of your examples and I have done

// BASIC ADDRESS ROUTING

var routing = {
    // midi cc vs widget id
    60: 'fader_1',
    61: 'fader_2',
    // etc
}

module.exports = {

    oscInFilter:function(data){
        // Filter incoming osc messages

        var {address, args, host, port} = data

        if (host === 'midi') {

            // MIDI routing !
            if (address === '/sysex') {

                // simple conditions
                if (args == 'f0 7e 00 06 01 f7') receive('midi:messing', '/sysex', 'f0 47 00 31 60 00 04 41 0A 01 12 f7')
            }

            return // bypass original message

        }


        // return data if you want the message to be processed
        return {address, args, host, port}

    }


}

I'm not getting quite the result yet although I have noticed your debugging messages have changed from

(DEBUG, OSC) In:  { address: '/sysex', args: 'f0 7e 00 06 01 f7' } From: midi:messing

to

(DEBUG, MIDI) in: SYSTEM_EXCLUSIVE: sysex=f0 7e 00 06 01 f7 From: midi:messing

Anyone any thoughts?

I wish I could run this custom module in a sort of a verbose way so I could traverse the communication that is going on with OSC.

You can use console.log() wherever needed to help debugging.

if (args == 'f0 7e 00 06 01 f7') receive('midi:messing', '/sysex', 'f0 47 00 31 60 00 04 41 0A 01 12 f7')

Don't you mean to use send() instead of receive() if you want to send a reply ?

2 Likes

Ok so custom module is working nicely , the issue is now the device behaviour has been altered, as the incoming messages look to have been altered by the usage of the custom-module

If I initiate the device with no custom-module this is how the messages are shown in the debugging output

(DEBUG, MIDI) in: CONTROL_CHANGE: channel=1, cc=26, value=68 From: midi:virtual-midimix
(DEBUG, OSC) In:  { address: '/control', args: [ 1, 26, 68 ] } From: midi:virtual-midimix

Whereas if I initiate the device with the custom-module I will get the messages in the following way

(DEBUG, MIDI) in: CONTROL_CHANGE: channel=1, cc=31, value=127 From: midi:virtual-midimix
(DEBUG, MIDI) out: CONTROL_CHANGE: channel=1, cc=31, value=125 To: midi:virtual-midimix

The thing is that now the device is not able to receive the change on parameters sent by the DAW, it does still send them properly and the DAW understands the incoming MIDI messages , the communication from DAW to device seems to not to be parsed properly by the widgets.

Any ideas? Thx

All sorted.

I have here a template of the custom module

// Open Stage Control Custom Module
//
// Name: Sysex verification for MIDI device
// Author: freddieventura
//
// Description:
// Some hardware MIDI devices "authenticate" with other gear by exchanging
// 2 Sysex messages , one is the ackRequest sent by the DAW or Master Device
// The MIDI Device will respond systematicaly with ackReply
// This Module automate this process , simply sniff the communication , grab
// the sysex on hexadecimal and replace the Variables
//
// i.e: Akai MIDI-Mix Sysex Verification module

ackRequest = 'f0 7e 00 06 01 f7';
ackReply = 'f0 7e 00 06 02 47 31 00 19 00 00 00 11 00 00 00 00 00 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7';
midiOutput = 'virtual-midimix';

module.exports = {

    oscInFilter:function(data){
        // Filter incoming osc messages
        var {address, args, host, port} = data
            // MIDI routing !
            if (host === 'midi' && address === '/sysex') {
                // simple conditions
                if (args[0].value == ackRequest) {
                    send('midi', midiOutput , '/sysex', ackReply);
                }
            }
        // return data if you want the message to be processed
        return {address, args, host, port};

    },

}
/* eof eof eof akai midi-mix sysex verification module eof eof eof */

2 Likes