Created
December 8, 2016 11:41
-
-
Save tnayuki/07580463ddd4e0cb6706e60fbd1166f1 to your computer and use it in GitHub Desktop.
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 getwild = [63, 61, 59, 63, 61, 59, 59, 59, 61, 63, 63, 64, 63, 59, 63, 63, 61, 59]; | |
var output = new midi.output(); | |
output.openPort(0); | |
var input = new midi.input(); | |
input.openPort(0); | |
var count = 0; | |
output.sendMessage([0x90, getwild[0], 127]); | |
input.on('message', function(deltaTime, message) { | |
if (((message[0] & 0xf0) == 0x90 && message[2] == 0) || (message[0] & 0xf0 == 0x80) ) { | |
if (message[1] == getwild[count]) { | |
count = (count + 1) % getwild.length; | |
output.sendMessage([0x90, getwild[count], 127]); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment