examples/device/midi2_device/README.md
USB MIDI 2.0 Device example that plays "Twinkle Twinkle Little Star" using native UMP (Universal MIDI Packet) format with full MIDI 2.0 expression.
The device exposes both USB-MIDI 1.0 (Alt Setting 0) and USB-MIDI 2.0 (Alt Setting 1) as required by the USB-MIDI 2.0 specification. A MIDI 2.0 capable host (e.g. Windows MIDI Services) will select Alt Setting 1 for native UMP transport. Legacy hosts use Alt Setting 0 with automatic MIDI 1.0 fallback.
| Interface | Class driver |
|---|---|
| 0–1 | MIDI 2.0 (audio control + MIDI streaming) |
Notable tusb_config.h settings:
#define CFG_TUD_MIDI2 1
CMake:
mkdir build && cd build
cmake -DBOARD=raspberry_pi_pico ..
cmake --build .
Make:
make BOARD=raspberry_pi_pico all
Linux:
aseqdump -p "MIDI 2.0 Device"
Windows (MIDI 2.0 native):
midi endpoint list
midi endpoint monitor
Twinkle Twinkle Little Star in C major, 120 BPM. Six phrases with dynamic shaping (pp to ff crescendo and back), pitch bend vibrato on sustained notes, and channel/poly pressure for expression. All values use genuine MIDI 2.0 resolution with no 7-bit equivalent.