Mike Ellis
Mike Ellis

Reputation: 1280

How to discover midi keyboard in web midi api?

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:

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

Upvotes: 1

Views: 2324

Answers (1)

Mike Ellis
Mike Ellis

Reputation: 1280

The answer to the question (linked below) from developer cwilso explains the problem. The browser has to be rebooted to detect new connected devices (even if web-midi is already enabled). Doing caused my adapter to be detected and available as an input device

Detect if a MIDI interface is connected in Web MIDI API

Upvotes: 1

Related Questions