-
-
Save creationmachine/19acde9c0f3b0ddcb9b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var socket = io.connect('http://localhost'); | |
socket.on('midi', function (data) { | |
console.log(data); | |
}); | |
</script> |
This file contains hidden or 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 app = require('express')() | |
server = require('http').createServer(app), | |
io = require('socket.io').listen(server), | |
midi = require('midi'), | |
input = new midi.input(); | |
input.on('message', function(deltaTime, message) { | |
console.log('m:' + message + ' d:' + deltaTime); | |
io.sockets.emit('midi', message); | |
}); | |
input.openPort(0); | |
server.listen(8000); | |
app.get('/', function (req, res) { | |
res.sendfile(__dirname + '/index.html'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment