Created
December 21, 2018 22:19
-
-
Save urish/5e433ae94fdd55b62cd85871abd3a2cf 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
(async function() { | |
const midi = await navigator.requestMIDIAccess(); | |
const midiOutput = Array.from(midi.outputs.values()) | |
.find(o => o.name.includes('Teensy')); | |
const midiInput = Array.from(midi.inputs.values()) | |
.find(o => o.name.includes('Keystation')); | |
// Forward all MIDI events from Keyboard to trumpet | |
midiInput.onmidimessage = ({data}) => | |
midiOutput.send([data[0], data[1], data[2] ? 127 : 0]); | |
})().catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment