Send different midi messages based on switch widget

Hi guys,

I have this use case where I have 4 buttons and 1 switch.

Each button is sending different midi message based on the selection of the switch. (keep in consideration that I add setInterval function to keep sending that message).

basically what I did, I put if statement in each button mentioning the switch and the required midi message.

It works fine but I thought doing it in this way and type codes in each button will be more complicated for bigger projects, hard to track the midi messages and time consuming, so I thought maybe you guys have smarter way to do it, maybe custom module or any other ideas.

this is the use case:
nudge_Trim.json (11.1 KB)

Hello Abdul,

I had an idea of a different approach. Basically I created a variable as an object with all the CCs values mapped to each switch state, using them as a key. Then, changed the switch to use an array of the key words as values, so I can use them to get the corresponding CC in the variable.
The buttons now have a simpler check.
Here's the new file.
nudge_Trim.json (9.8 KB)
I hope it helps.
Cheers.

2 Likes

BEAUTIFUL :ok_hand::ok_hand::ok_hand::ok_hand::ok_hand:

Thank you @ClelsonLopes for your quick response and smart idea.

1 Like