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!

image

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

image

This is what I want:

Address: /note
preArgs:
“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.

image

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.

https://openstagecontrol.ammd.net/docs/midi/

maybe that

@nlb’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!
:innocent:

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 the existing MIDI note messages?

Edit:

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 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else

1 Like

I cracked it.
This gives me so many options!

Thank you!

Here’s the working script:

JS{{

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?