OSC listener custom module and sysex

Hello

I wann use OSC listeners to show and hide stuff. To understand how it works I tried it first with address /control in the custom module. I need it to work with sysex data. I used the same logic as with the cc's. But it just doesn't work.

Here's the custom module:

module.exports = {

    oscInFilter:function(data)
	{
        var {address, args, host, port} = data

		if (address === '/sysex' ) {
			
			if (args.includes ('77 77 30 30 30 31')) {
			receive ('/track1/visible', 1);

			} 

			else {
				receive ('/track1/visible', 0);
			}
		}

	return {address, args, host, port}
	},
}

What i'm doing wrong?

Thank you

regards
mario

args is an array of objects of the following form:

{
  type: 'osc_typetag_letter',
  value: osc_value
}

In this case args is something like

[
  {
    type: 's', // string typetag
    value: 'f7 77 77...' // sysex string
  }
]

So you have to write

if (args[0].value.includes('77 77 30 30 30 31')) {
  // etc
}

It's working now! :grinning:

module.exports = {

    oscInFilter:function(data)
	{
        var {address, args, host, port} = data

		if (host === 'midi' && address === '/sysex') {

			var value = args[0].value
			if (value.includes('f0 00 00 66 05 00 10')) return
			
			if (value.includes('77 77 30 30 30 31')) {
			receive ('/track1/visible', 1);

			} 

			else {
				receive ('/track1/visible', 0);
			}
		}

	return {address, args, host, port}
	},
}
1 Like

thank you very much