Created
October 1, 2013 16:31
-
-
Save xseignard/6781263 to your computer and use it in GitHub Desktop.
send midi messages with node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var midi = require('midi'), | |
midiOut = new midi.output(); | |
try { | |
midiOut.openPort(0); | |
} catch(error) { | |
midiOut.openVirtualPort(''); | |
} | |
var loop = function() { | |
midiOut.sendMessage([144,60,100]); | |
console.log('note sent'); | |
}; | |
var interval = setInterval(loop, 1000); | |
process.on("SIGTERM", function(){ | |
clearInterval(interval); | |
midiOut.closePort(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment