Popravi za bitwig povezavo, skripta za midi naprave vzpostavit
parent
cac41f51a3
commit
c481574744
66
bitwig.js
66
bitwig.js
|
@ -1,36 +1,30 @@
|
||||||
const WebSocket = require('ws')
|
const WebSocket = require('ws')
|
||||||
const osc = require('osc')
|
const osc = require('osc')
|
||||||
|
|
||||||
const ip = process.argv[2]
|
const wwIP = process.argv[2]
|
||||||
|
const bwIP = process.argv[3]
|
||||||
|
|
||||||
const DEBUG = {
|
const DEBUG = {
|
||||||
osc: true
|
osc: true
|
||||||
}
|
}
|
||||||
|
|
||||||
const oscWS = new osc.WebSocketPort({
|
const oscWS = new osc.WebSocketPort({
|
||||||
url: `ws://${ip}:6676`,
|
url: `ws://${wwIP}:6676`,
|
||||||
metadata: false
|
metadata: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const bwPortUkazi = 8000
|
const bwPortUkazi = 8000
|
||||||
const bwPortStanje = 9000
|
const bwPortStanje = 9000
|
||||||
const bwIP = '192.168.64.113'
|
|
||||||
|
|
||||||
const oscWSstanje = new osc.UDPPort({
|
const oscBW = new osc.UDPPort({
|
||||||
localAddress: bwIP,
|
localAddress: bwIP,
|
||||||
|
remotePort: bwPortUkazi,
|
||||||
localPort: bwPortStanje,
|
localPort: bwPortStanje,
|
||||||
metadata: false
|
metadata: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const oscWSukazi = new osc.UDPPort({
|
|
||||||
localAddress: bwIP,
|
|
||||||
localPort: bwPortUkazi,
|
|
||||||
metadata: false
|
|
||||||
})
|
|
||||||
|
|
||||||
oscWS.on('ready', () => {
|
oscWS.on('ready', () => {
|
||||||
console.log(`Povezan sem na ${ip}`)
|
console.log(`Povezan sem na WW ${wwIP}`)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
console.log('ping')
|
console.log('ping')
|
||||||
|
@ -39,13 +33,15 @@ oscWS.on('ready', () => {
|
||||||
*/
|
*/
|
||||||
})
|
})
|
||||||
|
|
||||||
oscWSstanje.on('ready', () => {
|
oscBW.on('ready', () => {
|
||||||
console.log(`Prejemam bitwig info`)
|
console.log(`Povezan sem na bitwig ${bwIP}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
oscWSukazi.on('ready', () => {
|
const STANJE = {
|
||||||
console.log(`Pripravljen sem na posiljanje v bitwig`)
|
predvajam: 0,
|
||||||
})
|
track: 0,
|
||||||
|
clip: 0,
|
||||||
|
}
|
||||||
|
|
||||||
oscWS.on('message', ({ address, args }) => {
|
oscWS.on('message', ({ address, args }) => {
|
||||||
DEBUG.osc && console.log('MSG OSC', address, args.map(x => x.toFixed(4)))
|
DEBUG.osc && console.log('MSG OSC', address, args.map(x => x.toFixed(4)))
|
||||||
|
@ -55,6 +51,26 @@ oscWS.on('message', ({ address, args }) => {
|
||||||
const m = address.match(re)
|
const m = address.match(re)
|
||||||
|
|
||||||
if (m) {
|
if (m) {
|
||||||
|
console.log(address, m)
|
||||||
|
let bwUkaz = '/' + address.split('/').splice(3).join('/')
|
||||||
|
|
||||||
|
if (STANJE.predvajam && bwUkaz == '/play') {
|
||||||
|
bwUkaz = '/stop'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bwUkaz == '/track/next') {
|
||||||
|
bwUkaz = `/track/${STANJE.track}/selected`
|
||||||
|
oscBW.send({ address: bwUkaz, args: [0] })
|
||||||
|
bwUkaz = `/track/${STANJE.track+1}/selected`
|
||||||
|
oscBW.send({ address: bwUkaz, args: [1] })
|
||||||
|
}
|
||||||
|
if (bwUkaz == '/track/previous') {
|
||||||
|
bwUkaz = `/track/${STANJE.track}/selected`
|
||||||
|
oscBW.send({ address: bwUkaz, args: [0] })
|
||||||
|
bwUkaz = `/track/${STANJE.track-1}/selected`
|
||||||
|
oscBW.send({ address: bwUkaz, args: [1] })
|
||||||
|
}
|
||||||
|
oscBW.send({ address: bwUkaz })
|
||||||
/*
|
/*
|
||||||
oscWS.send({
|
oscWS.send({
|
||||||
address: '/midi',
|
address: '/midi',
|
||||||
|
@ -64,10 +80,18 @@ oscWS.on('message', ({ address, args }) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
oscWSstanje.on('message', ({ address, args }) => {
|
oscBW.on('message', ({ address, args }) => {
|
||||||
DEBUG.osc && console.log('BITWIG OSC', address, args.map(x => x.toFixed(4)))
|
DEBUG.osc && console.log('BITWIG OSC', address, args)
|
||||||
|
if (address == '/play') {
|
||||||
|
console.log('MENJAVA SATANJA PLAY', args)
|
||||||
|
STANJE.predvajam = args[0]
|
||||||
|
}
|
||||||
|
if (address == '/track/selected/position') {
|
||||||
|
STANJE.track = args[0]
|
||||||
|
console.log('MENJAVA SATANJA TRACKA', STANJE.track)
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
oscWS.open()
|
oscWS.open()
|
||||||
//oscWSstanje.open()
|
oscBW.open()
|
||||||
oscWSukazi.open()
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo modprobe snd-virmidi midi_devs=2
|
Loading…
Reference in New Issue