[howto] On the Zebra instrument, control the four PADs and vice versa

I have assigned x1 and y1 to the instrument for testing (Remote Control cc13,1 and cc13,2).
Controlling OSC works but as soon as I move the pad in Cubase, it does not participate in OSC.
What have I forgotten?

Here I have my settings

As soon as I turn in cubase, OSC does not update.

The xy pad still expects a message with two values (x and y), splitting the message using scripting doesn't tell osc to handle incoming messages any differently (see docs). Assuming your software sends the same feedback messages (channel 13, cc 1 and 2), you could create a script widget with:

  • target: midi:OSC (must match the midi port on which feedback is received)
  • address: /control
  • preArgs: 13
  • onValue:
if (value[0] == 1) { 
  // if cc 1
  set('xy_id', [value[1], '']) // update x
} else if (value[0] == 2) {
  // if cc 2
  set('xy_id', ['', value[1]]) // update y
}

Thank you for your quick reply.
I am now unsure how to integrate your script, in any case it does not work that way.
What have I misunderstood?

Hmmm... but not... I didn't even read your instructions and defined a script widget.
But something is still not quite right

There's a typo in my code, there should be no closing parenthesis at line 1 after value[0].

Thank you for the correction.
Now I defined everything, but it is not yet updated when I use the pad in Cubase.

Midi data is arriving:

I have positioned the script widget (script_pad1) on the same layer. (Or does it not matter in which layer the script widget is?)
Bildschirmfoto 2022-02-13 um 15.52.27

Here is the script widget:

Here is the xy widget:

Interestingly, when I place your lines of code in my main.js file, the pad is updated in Cubase's OSC. (Except that of course now CC1's come in from all channels, not just channel 13).
Since I have not yet much in the main.js file it works.

Can I still correct the script widget or should I still be able to set the channel (13) in the main.js file?

Check on o-s-c's side (with debug enabled in the launcher) if the message actually arrive, and if the midi port matches the script widget's target.

I have positioned the script widget (script_pad1) on the same layer. (Or does it not matter in which layer the script widget is?)

It doesn't matter.

Interestingly, when I place your lines of code in my main.js

I have no idea what main.js is, but I guess it's your custom module, in which case it's also possible to do it that way, but the code won't be the same at all, more something like

module.exports = {

    oscInFilter: function(data) {

        if (data.host === 'midi' && data.port === 'OSC' && data.address === '/control') { // is it really OSC ?
            
            var [channel, control, value] = data.args.map(x=>x.value)

            if (channel == 13) {
                if (control == 1) receive('/pad_address', '', value)
                if (control == 2) receive('/pad_address', value, '')
                // assuming no preArgs in xy pad, other you need to insert them in the message
                // receive('/pad_address', preArg1, preArg2, value, '')
            }

        }

        return data

    }
    
}

Sorry... yes, main.js is my custom-modul.

ok... midi is arrriving in channel 12 cc1 and cc2:

It arrives as MIDI but is not converted to OSC (which is how it gets passed to the widgets in the end), this means your custom module prevents the midi message from being passed, there must be a return statement (in my example, the return data line), as shown in the docs.

have I arranged my returns incorrectly?

main.js (13.1 KB)

It doesn't look wrong actually... is that the exact same file you are using ? Could you also export the launcher's config and upload it ?

That is my laucher config

And here is the file:
Launcher.config (244 Bytes)

Are you sure it's the exact same custom module file you're using ? Can you try without loading it and check if there are more messages in the debug log ? (each MIDI message should be followed by its OSC equivalent). And just in case, is there an error at some point before in the logs ?

So... I have tried it now without custom-module. Still the same behavior: OSC to Zebra (Cubase) works, Zebra to OSC does not work (OSC does not follow).

Sorry to insist, but please try to be exhaustive as it's hard to guess what you don't say, "still the same" leave too much room for interpretation :), does it mean the logs are identical ? Are there any errors before in the logs ?

Sorry..

No errors

Log when i turn Pad in OSC

Log when i turn Pad on Zebra

Alright so here I see the osc message are correctly generated after the incoming messages and there's no reason it doesn't reach the script correctly (you can add the line console.log(value) at the beginning of the script's onValue to check what the widget receives, it will be printed in the console which you can show with ctrl+k).

Now if the (DEBUG, OSC) lines disappear from the logs when you load the custom module then it means the custom module is in fault (and presumably, the uploaded file may differ from the one you use).

But then without the custom-module the xy-widget would work together with the script-widget. But it does not. Respective OSC > Cubase (Zebra) is ok, Zebra > OSC but the xy widget does not move.

Did you do as suggested to debug the script widget ?

Edit: another typo in the script code above:

} else if (value[1] == 2) {

should be

} else if (value[0] == 2) {

Désolé... c'est ma faute. Pour tester, j'avais placé l'entrée de script à un autre endroit et ne l'avais pas remise en place. Maintenant, tout fonctionne bien. Merci beaucoup pour ta patience...