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?
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
}
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
}
}
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.
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 ?
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.
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...