midi -> OSC

kegel
Jurij Podgoršek 2022-06-28 18:40:16 +02:00
parent 413900467c
commit 4407c45184
1 changed files with 14 additions and 8 deletions

View File

@ -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];