bitwig kontroliranje

main
Jurij Podgoršek 2022-09-20 21:42:52 +02:00
parent a332223248
commit cac41f51a3
2 changed files with 92 additions and 5 deletions

73
bitwig.js 100644
View File

@ -0,0 +1,73 @@
const WebSocket = require('ws')
const osc = require('osc')
const ip = process.argv[2]
const DEBUG = {
osc: true
}
const oscWS = new osc.WebSocketPort({
url: `ws://${ip}:6676`,
metadata: false
})
const bwPortUkazi = 8000
const bwPortStanje = 9000
const bwIP = '192.168.64.113'
const oscWSstanje = new osc.UDPPort({
localAddress: bwIP,
localPort: bwPortStanje,
metadata: false
})
const oscWSukazi = new osc.UDPPort({
localAddress: bwIP,
localPort: bwPortUkazi,
metadata: false
})
oscWS.on('ready', () => {
console.log(`Povezan sem na ${ip}`)
/*
setInterval(() => {
console.log('ping')
oscWS.send({ address: '/ping', args: [true]})
}, 500)
*/
})
oscWSstanje.on('ready', () => {
console.log(`Prejemam bitwig info`)
})
oscWSukazi.on('ready', () => {
console.log(`Pripravljen sem na posiljanje v bitwig`)
})
oscWS.on('message', ({ address, args }) => {
DEBUG.osc && console.log('MSG OSC', address, args.map(x => x.toFixed(4)))
// Wavey Wind sporočila
const re = /\/ww\/(\d+)\/([a-zA-Z]+)/
const m = address.match(re)
if (m) {
/*
oscWS.send({
address: '/midi',
args: [midiKanal, visina, 127]
})
*/
}
})
oscWSstanje.on('message', ({ address, args }) => {
DEBUG.osc && console.log('BITWIG OSC', address, args.map(x => x.toFixed(4)))
})
oscWS.open()
//oscWSstanje.open()
oscWSukazi.open()

View File

@ -30,13 +30,27 @@ byte KNOFI_LEN = 13;
// Za stanje vrednosti // Za stanje vrednosti
byte knofi_prej[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; byte knofi_prej[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
const char* kanali[15] = { // Kako dolgo pocakaj za dvoklik? (v milisekundah)
"/premakni/gor", int dvoklik_interval = 250;
"/premakni/dol",
"/premakni/levo", const char* kanali[16] = {
"/premakni/desno" "/play",
"/overdub/launcher",
"/recarm", // rabi info o trenutno izbranem tracku
"",
"",
"",
"",
"",
"",
"/clip/create/4",
"/clip/create/8",
"/clip/record" // rabi info o trenutno izbranem clipu / tracku
}; };
byte knofi_dvoklik[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
void setup() { void setup() {
for(int i = 0; i < KNOFI_LEN; i++) { for(int i = 0; i < KNOFI_LEN; i++) {
pinMode(knofi[i], INPUT_PULLUP); pinMode(knofi[i], INPUT_PULLUP);