Simulate user action when receiving a MIDI note

I have some stuff working for when receiving OSC, but I get 'double trigger' problems going from Bitwig to Open Stage - so... thinking of trying to use a MIDI note instead as these are discrete.

Can you help me with the syntax? I know for OSC it's:

if (address == '/user/0210' && args[0].value == 1023) {

But I have no idea for a MIDI note. Thanks!

if (address == '/note') {
  var [channel, note, velocity] = args.map(x=>x.value)
  if (channel === 1 && note === 64 && velocity === 127) {
    // etc 
  }
}

Thanks so much @jean-emmanuel! Will try this out

How do we set the MIDI 'device' to listen to?

// oscInFilter
var {host, port, address, args} = data 
if (host === 'midi' && port === 'device_name') {

}
1 Like

Still struggling with this!

In debug I see:

(DEBUG, MIDI) in: NOTE_ON: channel=1, note=61, velocity=100 From: midi:fx

Which looks fine. This is my custom module:

    oscInFilter:function(data){

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

        // Attempt at using MIDI note - can't get it to work
        if (address == '/note') {
         var [channel, note, velocity, port] = args.map(x=>x.value)
          if (note === 61 && velocity === 100 && port === 'fx') {
                    receive('/SET', 'Tribble-Rig-AShaperAutoOn', 1023)
            return
          }
        }

Not getting any response so far. Tried port === 'midi:fx' also

You are reassigning a wrong value to the port variable here:

var [channel, note, velocity, port] = args.map(x=>x.value)

You should write instead

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

// first filter port to avoid processing notes from other ports
if (port === 'fx') {
    // then filter by message type
    if (address === '/note') {
        // then extract meaningful data based on that
        var [channel, note, velocity] = args.map(x=>x.value)
        // now we can filter the event accurately
        if (note === 61 && velocity === 100) {
            receive('/SET', 'Tribble-Rig-AShaperAutoOn', 1023)
            return
        }
    }
}

AH, that fixed it! Thank you so much sir! :pray: