What is ESP32_Host_MIDI?
An open-source library that turns an ESP32-S3 into a complete multi-protocol MIDI hub. 9 simultaneous transports, one unified API. From classic DIN-5 to MIDI 2.0 with 16-bit velocity — all on a single chip.
Works with Arduino IDE, PlatformIO, and ESP-IDF. MIT license.
Supported Transports
- USB Host MIDI — plug any USB keyboard directly (< 1 ms)
- BLE MIDI — wireless to iOS, macOS, Android, Windows (3–15 ms)
- USB MIDI Device — ESP32 as class-compliant interface, no drivers (< 1 ms)
- RTP-MIDI / Apple MIDI — auto-discovery via Bonjour on WiFi (5–20 ms)
- OSC — bidirectional bridge to Max/MSP, Pure Data, SuperCollider (5–15 ms)
- ESP-NOW MIDI — low-latency wireless mesh between ESP32 boards (1–5 ms)
- UART / DIN-5 — classic 31250 baud serial MIDI (< 1 ms)
- Ethernet MIDI — AppleMIDI over W5500 SPI (2–10 ms)
- MIDI 2.0 / UMP — Universal MIDI Packets over WiFi UDP (5–20 ms)
All transports share one event queue. Messages from any input route to all outputs automatically.
MIDI 2.0 on a Microcontroller
Native MIDI 2.0 / UMP support between ESP32 boards over WiFi UDP:
- Note Velocity: 16-bit (65,536 steps vs 128 in MIDI 1.0)
- Control Change: 32-bit (4.29 billion steps)
- Pitch Bend: 32-bit (4.29 billion steps)
Received MIDI 2.0 packets auto-downscale to MIDI 1.0 for legacy transports.
Minimal Code
#include <ESP32_Host_MIDI.h>
void setup() { midiHandler.begin(); }
void loop() {
midiHandler.task();
for (const auto& ev : midiHandler.getQueue())
Serial.printf("%-12s %-4s ch=%d vel=%d\n",
ev.status.c_str(), ev.noteOctave.c_str(),
ev.channel, ev.velocity);
}
Configuration lives in a single mapping.h file — enable/disable transports, set WiFi credentials, BLE name, UART pins.
Hardware
Primary board: LilyGO T-Display-S3 (~$15)
- ESP32-S3 dual-core 240 MHz
- 1.9" 170x320 color TFT display
- USB-C with OTG
- WiFi + BLE 5.0
Also works on any ESP32-S3/S2 board (USB transports) or plain ESP32 (WiFi/BLE/UART).
What You Can Build
- Wireless MIDI adapter: USB keyboard → ESP32 → WiFi → DAW
- BLE-to-USB bridge: iPhone → ESP32 → USB Device → computer
- Vintage synth adapter: DIN-5 ↔ USB, no driver needed
- Wireless stage mesh: ESP-NOW between performers → single USB output
- Custom MIDI controller: buttons, faders, piezos → any transport
- MIDI-to-CV converter: with external DAC for Eurorack
- Live piano visualizer: notes light up on display as you play
- Real-time chord detection: integrated with gingoduino engine
14 ready-to-flash examples included.
Links
- GitHub: github.com/sauloverissimo/ESP32_Host_MIDI
- Documentation: sauloverissimo.github.io/ESP32_Host_MIDI
- Gingoduino: Music theory engine for microcontrollers
Saulo Verissimo