At note on, one "/note" MIDI message; At note off, another "/note" MIDI message

Is it possible the following configuration for a button widget in OSC?

When ON (when pressed):
address: /note
preArgs: [1, 1]

When OFF (when released):
preArgs: [1, 2]

Thank you!

Setting preArgs to something like this should work :
[1, JS{{ return @{this} == @{this.on} ? 1 : 2 }}]

Thank you so much! It works!

What my problem was:
Cubase 10 Pro has two places in which you can define shortcuts ("keyboard shortcuts" & "generic remote shortcuts"). The thing is, making a shortcut for selecting a specific track in the project is available only through Generic Remote. Hopefully, now (with your solution) I will be able to set a MIDI note message for selecting a certain track, and another MIDI note message to run a menu entry (all triggered from a single OSC button).

Look what I did (before reading your reply), using a combination of strokeMIDI and Cubase's 10 Generic Remote:
https://youtu.be/M0mda5_vqFU

EDIT:
I just tested your code with Cubase (to do the exact same thing in the video I posted above).
Here are the values for the push button:

Here are the values in the Generic Remote:

Glad you sorted it out ! For the record, here is another way to send multiple messages with a single widget : Two or more osc address on a toggle button (it may look more complicated but I think it’s easier to understand and maintain).

1 Like

Hi again, Jean!

This topic was created more than a year ago. It's old, but still very-very helpful!

Today I'm proud to announce people that I managed to use the second method you suggested. I am happy, so, so, so very happy!

This is the script:


// When the toggle button is on (127),
// a note message will be sent (channel 4, note 0, velocity 127).

if (value === 127) {
send('midi:SessionKiano', '/note', 4, 0, 127)

// When the toggle button is off (1, in my case), the same note message
// will be sent, but this time I can use a note that is on channel 5 (not
// the same one (that the other method was forcing me to be limited to). 

} else {
send('midi:SessionKiano', '/note', 5, 0, 127)
}
1 Like