Use a single Dropdown widget to send different note MIDI messages (Value 1 = note 01, Value 2 = note 60, etc)

Is it possible to assign a different preArgs value for every item in the dropdown? Having this option would save me a lot of screen space!


For example, when choosing the “Value 4” item, I’d like OSC to send:


This is what I want:

Address: /note
“Value 1” = [1, 121]
“Value 2” = [1, 122]
“Value 3” = [1, 123]
“Value 4” = [1, 124]

Thank you!

If I understand correctly, you need to put @{this.value} in the preArgs field

Sorry, but your reply doesn’t help at all. Have you done it? Do you know if what I’m asking is possible? I’m asking because I’m tired of searching ways that don’t exist. Thank you for understanding.


Thanks, but it doesn’t work.

What does not work ? screenshots ?

For “Value 1” (in the dropdown) I get this:

I think that in order to send diferent MIDI note messages using a dropdown I need to use a script widget.

ok so you get what you asked for no ? preArgs are good.

The midi error is another kind of problem. not able to help you fot that. sorry.

Not at all.

Nope. It is not a different kind of problem. I need to use a script, but don't know how to do it yet.

maybe that

@Greenman’s answer was correct but you need to adjust preArgs in order to send the appropriate numbers of midi arguments. For example, setting preArgs to 1 (ie channel 1) would let you define each item in values as a [note_number, velocity] pair.

The other way around this would be very similar to a previous request of yours (One button widget that sends different values to multiple CC's) except you’d need to use conditions (if…else) to define the values you send based on the switch’s value.

Thank you!

It wooooooorks!

Here's what I've done so far:

What do I need to type in the script field so that the "Value 1" (velocity = 1) button of the switch widget can trigger both MIDI note messages?


I figured it out, but I don't know how to add settings for the second value ("Value 2").

1 Like

i was far from the good solution… :slight_smile: but thanks for your feedback with the solution with the big help of @jean-emmanuel as usual !

Check this out to learn more about this syntax :

1 Like

I cracked it.
This gives me so many options!

Thank you!

Here’s the working script:


if (value == 1)
send(false, “/note”, 1, 121, 127)

else if (value == 2)
send(false, “/note”, 1, 122, 127)
send(false, “/note”, 1, 123, 127)

else if (value == 3)
send(false, “/note”, 1, 124, 127)
send(false, “/note”, 1, 125, 127)
send(false, “/note”, 1, 126, 127)


1 Like

Reading the link you gave me (One push button sends a sequence of values?), I can say that I find it useful for my new problem. See, through the widget itself or by using a script I managed to make a dropdown/switch to send different MIDI note messages (Value 1 = note 1; Value 2 = note 2, etc). Now, I need to send multiple MIDI messages in a given order and with a little bit of delay between them. I hope to get an understanding about how custom modules work.

Indeed, this thread contains an example of timed messages sequence : One push button sends a sequence of values?


Reading some threads, to learn...

Just one question. In this :

send(false, “/note”, 1, 126, 127)

is "false" the midi port's name ? Or does that mean anything else ?

Thank you

Hi there!

This syntax is not available anymore. In the new O-S-C version (v1 as opposed to v0), things are done a bit differently.

To answer your question: In the old syntax you needed to type "false" so that – when executed – the send() function would be prevented from ignoring the target property (located in the Inspector) of the widget. As you may know, the target can be either a MIDI address (midi:midiPort) or an OSC address (ip:port).

"Target" property in the Inspector (screenshot)

I'm kinda' repeating myself here. Don't open.

The documentation for O-S-C v0 says that the send() function ignores the script's targets and the server's defaults (launcher's defaults) unless target (the target property in the Inspector) is false.
Thus, send(false, "/note", 1, 126, 127) will use the target specified in the target property (so you were close when you assumed that it's the midi port's name).
If you wanted to use a different target, you had to specify one like this:
send("midi:midiPort", "/note", 1, 126, 127)

You can read more about scripting in O-S-C v0 here.

1 Like

Thank you :wink:

1 Like