Created
January 1, 2020 16:48
-
-
Save scriptype/5aec3740e407d9c575a400881201cf06 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
navigator.requestMIDIAccess() | |
.then(onMIDISuccess, onMIDIFailure); | |
function onMIDIFailure() { | |
console.log('Could not access your MIDI devices.'); | |
} | |
function onMIDISuccess(midiAccess) { | |
console.log(midiAccess); | |
var inputs = midiAccess.inputs; | |
var outputs = midiAccess.outputs; | |
for (var input of inputs.values()) { | |
input.onmidimessage = getMIDIMessage; | |
} | |
} | |
function getMIDIMessage(midiMessage) { | |
console.log(midiMessage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment