From 36d86e323d94e33d381a313719d66bd5c6d116c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Sat, 23 Apr 2022 16:13:34 +0200 Subject: [PATCH] WIP midi --- server.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server.js b/server.js index 0a24ca0..3d6c38e 100644 --- a/server.js +++ b/server.js @@ -52,6 +52,13 @@ const server = http.Server(app); // Odprti serijski OSC link let scon = null +// Midi port +const mo = new midi.Output() +//mo.getPortCount() +//mo.getPortName(0) +//mo.openPort(0) +mo.openVirtualPort("kegel") + function openSerial() { console.log('opening ', tty, baudrate) @@ -231,6 +238,13 @@ const sendAll = (msg, info, oscWS, osclients) => { }, info, oscWS, osclients) } + if (msg.address == '/accel') { + if (msg.args[1] > 5000) { + console.log("SEND MIDI!") + mo.sendMessage([176, 22, 1]) + } + } + osclients.forEach( client => { if (client && oscWS != client) { // console.log("sending", msg, info) @@ -275,3 +289,5 @@ wss.on('connection', function (ws) { */ }) +// Zapri midi +mo.closePort()