Home:ALL Converter>How to discover midi keyboard in web midi api?

How to discover midi keyboard in web midi api?

Ask Time:2014-04-22T00:02:01         Author:Mike Ellis

Json Formatter

reference: Browsers in 2013 with Web MIDI API?

I'm currently running Chrome 34.0.1847.116 on OS 10.9.2 and experimenting with the Web Midi API. After enabling chrome://flags/#enable-web-midi, I'm able to get a midiAccess object by pasting the following code from http://www.w3.org/TR/webmidi/ into the DevTools console.

var midi = null;  // global MIDIAccess object

function onMIDISuccess( midiAccess ) {
  console.log( "MIDI ready!" );
  midi = midiAccess;  // store in the global (in real usage, would probably keep in an object instance)
}
function onMIDIFailure(msg) {
console.log( "Failed to get MIDI access - " + msg );
}
navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );

When I query midi.inputs() and midi.outputs(), the returned list contains only IAC Bus devices. My midi keyboard (connected with a Turtle Beach USB midi adapter) does not show up. In trying to diagnose the problem, I've so far found the following:

  • The adapter is visible in OS X's Audio/Midi Setup and the keyboard works correctly with Logic Pro as well as with homebrew CoreMidi code.
  • The web synth example at http://webaudiodemos.appspot.com/monosynth/index.html also fails to find the keyboard and does not make sound when keys are pressed.
  • The web synth example at http://djazz.se/lab/synth/ does make sound when I click on its virtual keys. DevTools shows that it's using an IAC Bus device.

What do I need to do to help Chrome find non-IAC MIDI devices?

Author:Mike Ellis,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/23200972/how-to-discover-midi-keyboard-in-web-midi-api
yy