pipe midi events from canary into node over websockets
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
node_modules |
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
skateboard(function(stream) { | |
// see: http://webaudio.github.io/web-midi-api/ | |
navigator.requestMIDIAccess().then(function sucess(midi) { | |
var inputs = midi.inputs(); | |
console.log('inputs:', inputs); | |
if (inputs.length > 0) { | |
inputs[0].onmidimessage = function(ev) { | |
console.log('sending', ev.data); | |
stream.write(new Int8Array(ev.data)); | |
}; | |
} | |
}, function error(e) { | |
throw e; | |
}); | |
}); |
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
<html> | |
<head> | |
<title>midi over websockets demo</title> | |
<script type="text/javascript" src="skateboard.min.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript" src="client.js"></script> | |
</body> | |
</html> |
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
{ | |
"dependencies": { | |
"midi": "^0.8.1", | |
"skateboard": "^0.2.8" | |
} | |
} |
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'); | |
var skateboard = require('skateboard'); | |
var output = new midi.output(); | |
output.openVirtualPort('hello again'); | |
var midiStream = midi.createWriteStream(output); | |
skateboard({ dir: './', port: 9888 }, function(stream) { | |
stream.pipe(midiStream); | |
stream.on('data', function(d) { | |
console.log(d); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment