XY Pad recieve variable from another widget

Hey, folks!

I haven't updated my OSC controller in a while but I wanted to add a new XY module to it.

I am looking to have the buttons (MOD,BREATH,EXP) set numbers (mod=1, breath=2 ,exp = 11) to variables varPadX, and varPadY when toggled, and then the X or Y part of the pad, would send CC data for the corresponding controllers.

I can't seem to get things functioning though, and I have very little coding knowledge sadly. I would greatly appreciate some assistance. Thank you! <3

My variable widgets are called varPadX and varPadY

My X buttons have the following code. (the second two lines just toggle off the other buttons like a switch)

var xValue = get('varPadX')

if (value == 1) {
  set('BREATH', 0),
  set('EXP', 0),
  set('varPadX', xValue = 1)
}

and my XY pad has the following code.

var padx = get('varPadX'),
    pady = get('varPadY')
    
var x = value[0]
var y = value[1]
      
      
send('midi:osc', '/control', 1, padx, 1, x)
send('midi:osc', '/control', 1, pady, 1, y)

image

1 Like

At first sight this line seems weird (the statement xValue = 1 always returns 1, assigning a value to xValue doesn't make much sense here), this might be less confusing:

set('varPadX', 1)

Then

send('midi:osc', '/control', 1, padx, 1, x)

is incorrect because there should be only 3 arguments after '/control' (channel, cc number, cc value), maybe just remove the second-to-last argument ?

Thank you! Those were the two things that were preventing it from working. It all works great now.

Much appreciated, Jean-Emmanuel!

That looks great. Would you be willing to share that x/y pad?

Hi, @Mike1 !

Absolutely! Here is the .json file.

XY PAD.json (57.8 KB)

Only thing you need to to do to get it working is to change the midi name in both the XY Pad and XP Expanded pad from midi:osc to whatever name you use
image

Let me know if you improve on it at all! I'd love to see if there's anything I can do to make it better!

1 Like

Thank you very much