Web MIDI
Lets a site send and receive MIDI messages to music gear.
In one line
Can send and get notes with music gear, after you allow it
Lets a site send and receive MIDI messages to music gear.
Exposes the names of connected MIDI ports and live note and control data from keyboards and pads. With sysex it can reconfigure or flash devices.
What it can and can't do
What the user does: You tap Connect keyboard and allow MIDI access in the pop up.
It can
- Listen for notes from your keyboard or controller
- Send notes and lights to your music gear
- Show a stronger warning before deeper control called sysex
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 if you remove the permission
How it differs between platforms: Chrome, Edge and Firefox support it. 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 | None |
| 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}), inputs, outputs, onmidimessage, output.send() |
| Permission name | midi |
| Permissions policy | midi |
| Browser compat keys | api.MIDIAccessapi.MIDIInputapi.MIDIOutputapi.Navigator.requestMIDIAccess |
| How access is granted | prompt |
| What the user sees | Permission bubble: use MIDI devices (sysex prompt is stronger) |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Per origin; sysex separate from basic |
| How to take it back | Site settings |
| Inside an iframe | Needs allow="midi" |
Typical flow
- requestMIDIAccess()
- Prompt
- Iterate inputs and outputs
- Listen for midimessage
Data you get
What comes back: MIDI messages with timestamps
Shape: event
How often: per message
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
port.name / manufacturer / id | string | None | device defined | stable id per origin |
data | binary | bytes | status 0x80 to 0xFF, data bytes 0 to 127; sysex up to device limit | Not listed |
timeStamp | float | ms | DOMHighResTimeStamp | microsecond class |
Technical limits
- Cannot play audio itself
- Safari and iOS do not implement it
- Needs HTTPS in Chrome
The story
What it is
A site can send and receive music signals with your gear.
For you
A pop up asks to use your music devices. After you allow it, your keyboard and a page play together.
For makers
Makers build online synths, lessons and studios that act like desktop music software. It cuts install friction for music apps.
Where you see it
| Type | Example | Apps |
|---|---|---|
| music | A browser studio records what you play on a MIDI keyboard. | BandLab, Soundtrap |
| education | A piano learning site shows which keys you hit. | Flowkey |
| games | A rhythm game uses your drum pad. | None named |
| live | A live visual artist links controller knobs to a stage show. | None named |
| creative | A sound design site lets you tweak a hardware synth from a web page. | None named |
| security | A site can list your MIDI gear, which adds to a device fingerprint. | None named |
Risks
- Device fingerprint
- Changing device settings
What the platform says
- Mozilla: Web MIDI API. MDN says Web MIDI lets web pages connect to and use musical instruments and controllers.
Good uses and abuse
Legitimate uses
- Browser DAWs and synths
- MIDI learn controls
- Device editors
Known abuse
- Port list as a fingerprint
- Sysex writes to firmware
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 2 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2015-04, Chrome 43: Web MIDI ships
- 2020, Chrome 77: Permission required for all use, not only sysex
- 2022-10, Firefox 108: Firefox ships Web MIDI behind a site permission add-on prompt
Related capabilities
Related
- Gamepad API and haptics. Can see your game controller after you press a button, and make it rumble
Sources
How well checked: Checked against real behavior.