I am making a controller from the template @DMDComposer JoeHidden posted on Vicontrol, but some of the functions do not work properly.
I've seen a similar post in the community before.
It was two years ago, and I recently learned about OSC and have been trying to fix it from there, but it's not working, so I thought I'd ask a question.
Here is the code.
var oscHost = '127.0.0.1';
var oscPort = '8080';
// Variables for Transpose Module
var transposeInterval = 0;
var transposeCopy = false;
module.exports = {
oscInFilter:function(data)
{
var {address,args,host,port} = data
if (address === '/transpose') {
console.log( '/control')
switch (args[0].value) {
case 'up':
if (transposeCopy) {
sendOsc({ address: '/control', args: [{ type: 'i', value: 8 }, { type: 'i', value: 24 + transposeInterval }, { type: 'i', value: 127 }], host: 'midi', port: 'OSCtoDAW' });
} else {
sendOsc({ address: '/control', args: [{ type: 'i', value: 8 }, { type: 'i', value: 0 + transposeInterval }, { type: 'i', value: 127 }], host: 'midi', port: 'OSCtoDAW' });
}
break;
case 'down':
if (transposeCopy) {
sendOsc({ address: '/control', args: [{ type: 'i', value: 8 }, { type: 'i', value: 36 + transposeInterval }, { type: 'i', value: 127 }], host: 'midi', port: 'OSCtoDAW' });
} else {
sendOsc({ address: '/control', args: [{ type: 'i', value: 8 }, { type: 'i', value: 12 + transposeInterval }, { type: 'i', value: 127 }], host: 'midi', port: 'OSCtoDAW' });
}
break;
}
return
}
if (address === '/transposeInterval') {
transposeInterval = args[0].value;
new_label = ["m2", "M2", "m3", "M3", "P4", "TT", "P5", "m6", "M6", "m7", "M7", "P8"];
receive('/EDIT', 'modal_transpose_interval', { type: 's', value: { 'label': new_label[args[0].value] } });
receive('/modal_transpose_interval', 0);
return;
}
if (address === '/transposeClose') {
receive('/modal_transpose_interval', 0);
return;
}
if (address === '/transposeCopy') { transposeCopy = args[0].value; console.log('Transpose Copy = ' + args[0].value); return; }
return {address, args, host, port}
}
}
I think the code is working, but the message that comes back from OSC when I click on the interval
(DEBUG, OSC) Out: { address: '/transposeInterval', args: [ { type: 's', value: 2 } ] } To: 127.0.0.1:8000
Then, when you press the button to “/transpose up|down”
(DEBUG, OSC) Out: { address: '/transpose', args: [ { type: 'i', value: NaN } ] } To: 127.0.0.1:8000
I get "Nan" and Cubase doesn't even get the message.
The other functions work fine, so I assume that the MIDI device that is OSCtoDAW is well declared.
I apologize for this amateur question,
Could you tell me where the problem is?