Skip to content

Instantly share code, notes, and snippets.

@xseignard
Created October 1, 2013 16:31
Show Gist options
  • Save xseignard/6781263 to your computer and use it in GitHub Desktop.
Save xseignard/6781263 to your computer and use it in GitHub Desktop.
send midi messages with node.js
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