Page 1 of 1

[Library] ESP32_Host_MIDI v5.0.0 — 9 MIDI transports on one ESP32-S3 (USB Host, BLE, Apple MIDI, OSC, ESP-NOW, DIN-5, MI

Posted: Tue Feb 24, 2026 5:07 pm
by sauloverissimo
Hello everyone,

I'd like to share a library I've been developing for the past year: ESP32_Host_MIDI — a unified MIDI hub that runs 9 simultaneous transports on a single ESP32-S3.

Supported transports

Code: Select all

Transport                  Stack                                    Latency
─────────────────────────  ───────────────────────────────────────  ─────────
USB Host MIDI              ESP-IDF USB Host + custom MIDI parser    < 1 ms
BLE MIDI                   NimBLE, BLE MIDI 1.0 spec               3-15 ms
USB MIDI Device            TinyUSB CDC, class-compliant             < 1 ms
RTP-MIDI / Apple MIDI      AppleMIDI + mDNS Bonjour                5-20 ms
OSC                        UDP, bidirectional                       5-15 ms
ESP-NOW MIDI               ESP-NOW broadcast/unicast                1-5 ms
UART / DIN-5               HardwareSerial, 31250 baud              < 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 are managed by a single MIDIHandler that maintains a unified event queue. Messages from any input are available to all outputs.

Technical highlights
  • USB Host: Full enumeration, hot-plug, descriptor parsing. Tested with 15+ USB MIDI keyboards/controllers. Handles multi-endpoint devices.
  • MIDI 2.0 / UMP: Complete UMP layer — parser, builder, velocity scaler (7↔16↔32-bit). Two ESP32 boards can exchange 16-bit velocity over WiFi UDP, with automatic downscaling to MIDI 1.0 for legacy transports.
  • BLE MIDI: Full BLE MIDI 1.0 specification. Tested with iOS (GarageBand, AUM), macOS (Logic Pro, Ableton), and Android.
  • Apple MIDI: mDNS/Bonjour auto-discovery. Shows up in macOS Audio MIDI Setup without any manual configuration.
  • ESP-NOW: Low-latency wireless mesh. Ideal for multi-board setups (e.g., wireless stage rig with multiple controllers feeding one output).
Minimal code

Code: Select all

#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 is done in a single mapping.h file per project — enable/disable transports, set WiFi credentials, BLE name, UART pins, etc.

Tested hardware

Primary: LilyGO T-Display-S3 (ESP32-S3, 1.9" TFT, USB-C OTG)
Also works on: any ESP32-S3/S2 board (USB transports), plain ESP32 (WiFi/BLE/UART transports), ESP32-P4 (dual UART, native Ethernet)

Compatibility
  • Arduino IDE (Library Manager or .zip)
  • PlatformIO (lib_deps)
  • ESP-IDF as Arduino component (tested with ESP-IDF 5.x)
14 examples included, all with display output on T-Display-S3.

Photos

Image
Piano visualizer — real-time note display

Image
MIDI 2.0 — 16-bit velocity between two ESP32 boards

Image
BLE MIDI receiving from iPhone

Links
License: MIT

I'd appreciate any feedback, especially from people working with USB Host on ESP32-S3 or interested in MIDI 2.0 on embedded. If you have questions about the implementation or want to discuss specific transports, happy to go into detail.