17 lines
488 B
JavaScript
17 lines
488 B
JavaScript
|
const midi = require('midi')
|
||
|
|
||
|
let mo = new midi.Output()
|
||
|
let mi = new midi.Input()
|
||
|
|
||
|
mo.openVirtualPort("debug-out")
|
||
|
mi.openVirtualPort("debug-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}`)
|
||
|
mo.send(message)
|
||
|
})
|