midi -> OSC
parent
413900467c
commit
4407c45184
22
server.js
22
server.js
|
@ -78,14 +78,6 @@ if (MIDI) {
|
||||||
//mo.openPort(0)
|
//mo.openPort(0)
|
||||||
mo.openVirtualPort("kegel")
|
mo.openVirtualPort("kegel")
|
||||||
mi.openVirtualPort("ww-midi-in")
|
mi.openVirtualPort("ww-midi-in")
|
||||||
|
|
||||||
mi.on('message', (deltaTime, message) => {
|
|
||||||
// The message is an array of numbers corresponding to the MIDI bytes:
|
|
||||||
// [status, data1, data2]
|
|
||||||
// https://www.cs.cf.ac.uk/Dave/Multimedia/node158.html has some helpful
|
|
||||||
// information interpreting the messages.
|
|
||||||
console.log(`midi in: ${message} d: ${deltaTime}`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openSerial(ttyAddr) {
|
function openSerial(ttyAddr) {
|
||||||
|
@ -214,6 +206,20 @@ scudp.on('error', (e) => {
|
||||||
})
|
})
|
||||||
scudp.open()
|
scudp.open()
|
||||||
|
|
||||||
|
if (MIDI) {
|
||||||
|
mi.on('message', (deltaTime, message) => {
|
||||||
|
// The message is an array of numbers corresponding to the MIDI bytes:
|
||||||
|
// [status, data1, data2]
|
||||||
|
// https://www.cs.cf.ac.uk/Dave/Multimedia/node158.html has some helpful
|
||||||
|
// information interpreting the messages.
|
||||||
|
console.log(`midi in: ${message} d: ${deltaTime}`);
|
||||||
|
sendAll({
|
||||||
|
address: '/midi',
|
||||||
|
args: message
|
||||||
|
}, info, oscWS, osclients)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function eulerFromQuaternion(quaternion) {
|
function eulerFromQuaternion(quaternion) {
|
||||||
// Quaternion to matrix.
|
// Quaternion to matrix.
|
||||||
const w = quaternion[0], x = quaternion[1], y = quaternion[2], z = quaternion[3];
|
const w = quaternion[0], x = quaternion[1], y = quaternion[2], z = quaternion[3];
|
||||||
|
|
Loading…
Reference in New Issue