Web MIDI (midi and midi sysex)
Asks to talk to connected music gear such as keyboards and controllers.
In one line
Can talk to your connected music gear, with a prompt for deeper control
Asks to talk to connected music gear such as keyboards and controllers.
Two permission levels: plain MIDI sees note and control data; sysex also sends vendor system messages that can reprogram a device. Reveals which music devices you own.
What it can and can't do
What the user does: You tap Connect keyboard or Connect MIDI on a music site.
It can
- Listen to notes from a keyboard or controller you have plugged in
- Send notes and lights to the device
- Ask for deeper control, called sysex, that shows a stronger warning
It cannot
- Use any music gear before you allow it
- Change the gear's settings with sysex unless you allow that
- Work in Safari or on iPhone
- Keep access after you clear permissions or close the site
How it differs between platforms: Chrome, Edge and Firefox support it. Firefox may need an add on for sysex. Safari and iPhone do not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 43 | 2015-05-19 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 108 | 2022-12-13 | Add-on required in 108 |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Supported | 43 | 2015-05-27 | None |
| Samsung Internet | Supported | 4.0 | 2016-03-11 | None |
How a site asks for it
| API | navigator.requestMIDIAccess({sysex}); permission midi with descriptor {sysex:true} |
| Permission name | midi |
| Permissions policy | midi |
| Browser compat keys | api.Navigator.requestMIDIAccess |
| How access is granted | prompt |
| What the user sees | Chromium prompt: Control and reprogram your MIDI devices when sysex is requested; Chrome 124 prompts for any MIDI access. Firefox 108 needs an add-on install for sysex. |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | Yes |
| How long it lasts | Persistent per origin |
| How to take it back | Site settings; Permissions API midi |
| Inside an iframe | Needs allow="midi" in iframes |
Typical flow
- Call requestMIDIAccess({sysex})
- Permission prompt
- Enumerate inputs and outputs
- Send and receive MIDI messages
Data you get
What comes back: MIDIInput and MIDIOutput ports
Shape: list
How often: on call plus statechange events
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
port id | string | opaque | per origin | high entropy |
manufacturer, name | string | text | device strings | high entropy |
version | string | text | device firmware | some bits |
Technical limits
- Safari does not support
- Sysex needs the stronger permission
- Needs secure context
The story
What it is
A site asks to connect to your music gear, like a keyboard or drum pad.
For you
A pop up asks 'Allow this site to use your MIDI devices?'. If you say yes, a plugged in keyboard plays notes in the page.
For makers
Makers can build full music apps in a tab: synths, lessons and recording. A special system mode can even rewrite a device's settings, so the browser asks more carefully.
Where you see it
| Type | Example | Apps |
|---|---|---|
| music | You play a plugged in keyboard and hear piano notes in the browser. | BandLab, Soundtrap, Chrome Music Lab |
| education | A piano lesson site watches which keys you press and scores you. | Flowkey |
| games | A rhythm game lets you play with a MIDI drum pad. | None named |
| creative | A visual artist links a controller's knobs to a live visual show. | None named |
| live | A DJ tool in the browser reads a controller for mixing. | None named |
| security | A site can tell which MIDI devices exist, which adds to a fingerprint. | None named |
Risks
- Device fingerprint
- Changes device settings
What the platform says
- Mozilla: Web MIDI API. MDN says the API lets pages talk to MIDI devices like keyboards and drum machines.
Good uses and abuse
Legitimate uses
- DAWs
- Hardware editors
Known abuse
- Device fingerprinting by connected gear
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 2 of 5 | How much the user has to do |
| Fingerprint bits | 5 | Rough identifying entropy, when known |
History
- 2015-05, Chrome 43: Web MIDI ships
- 2022-12, Firefox 108: Web MIDI behind add-on install prompt
- 2024-04, Chrome 124: Prompt for any MIDI access, not only sysex
Related capabilities
Related
- Permissions API. Can check whether you allowed or blocked a feature, without asking you
Sources
How well checked: Based on official documentation.