Device Access

Web MIDI

Probing…

Web MIDI is a web platform capability in the Device Access category. Connect MIDI instruments and controllers. Supported in Chromium 43+ and Firefox 108+; not available in Safari. Requires a secure context (HTTPS or localhost) and a user gesture such as a click or tap.

Secure contextUser gesture

Permission midi: unknown

Try it

Loading demo…

Code

const access = await navigator.requestMIDIAccess()

for (const input of access.inputs.values()) {
  input.onmidimessage = ({ data }) => {
    const [status, note, velocity] = data
    console.log('status', status.toString(16), note, velocity)
  }
}

// Send Middle C note-on/off to the first output
const [output] = access.outputs.values()
output?.send([0x90, 60, 0x7f])
output?.send([0x80, 60, 0x00])

Browser support

Chromium
43
Firefox
108
Safari
No

Frequently asked questions

Which browsers support Web MIDI?

Supported in Chromium 43+ and Firefox 108+; not available in Safari.

Does Web MIDI require HTTPS?

Yes. Web MIDI needs a secure context, so it only works over HTTPS (or on localhost during development).

What is Web MIDI used for?

Connect MIDI instruments and controllers.

Can I try Web MIDI in my browser?

Yes. shwcs.net runs a live Web MIDI demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗