Created
August 30, 2015 03:44
-
-
Save iccir/f47e439fd3dc4536baa3 to your computer and use it in GitHub Desktop.
MIDI Messages
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
// See chart at http://www.midi.org/techspecs/midimessages.php | |
function handleMIDIMessage(message) | |
{ | |
var status = message.data[0]; | |
var note = message.data[1]; | |
var velocity = message.data[2]; | |
var type = status >> 4; | |
var channel = status & 0xf; | |
if (type == 0x8) { | |
handleNoteOff(channel, note); | |
} else if (type == 0x9) { | |
handleNoteOn(channel, note, velocity); | |
} else if (type == 0xa) { | |
handleAftertouch(channel, note, velocity); | |
} else { | |
// ... handle other types here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment