Files
tinyusb/examples/device/midi2_device
hathach 4b1c8d16f7 docs: add build-doc tooling and a README for every example
Documentation tooling:
- Add the `build-doc` skill and `tools/build_doc.py` wrapper for local
  Sphinx builds (clean / -W / open).
- Enable Markdown (MyST) in conf.py and auto-collect
  examples/{device,host,dual}/*/README.md into a 3-level Examples nav
  (Examples > Device/Host/Dual > example), noting each page's source
  location and normalizing headings to a single H1.
- Remove the stale `.claude/commands/build-doc.md`; point the AGENTS.md
  Documentation section at the skill.

Example docs:
- Add a README.md for every device/host/dual example: what it does, USB
  interface table, notable tusb_config.h settings, generic CMake + Make
  build steps, and how to try it.
- Fold each *_freertos variant into its base README, noting the FreeRTOS
  source path and any RTOS-specific behavior.

Generated docs/examples/ output is git-ignored. Builds clean with
`sphinx-build -W`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:16:25 +07:00
..
2026-06-14 20:25:02 +08:00
2026-05-17 14:05:03 +02:00

MIDI 2.0 Song Sender

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.

MIDI 2.0 Features Demonstrated

  • 16-bit Velocity (vs 7-bit MIDI 1.0)
  • 32-bit Control Change values
  • 32-bit Pitch Bend (vs 14-bit MIDI 1.0)
  • 32-bit Channel Pressure (Aftertouch)
  • 32-bit Poly Pressure (Per-Note Aftertouch)
  • Per-Note Management (MIDI 2.0 exclusive)
  • Program Change with Bank Select
  • JR Timestamps

USB Descriptors

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
01 MIDI 2.0 (audio control + MIDI streaming)

Configuration

Notable tusb_config.h settings:

#define CFG_TUD_MIDI2           1

Building

CMake:

mkdir build && cd build
cmake -DBOARD=raspberry_pi_pico ..
cmake --build .

Make:

make BOARD=raspberry_pi_pico all

Testing

Linux:

aseqdump -p "MIDI 2.0 Device"

Windows (MIDI 2.0 native):

midi endpoint list
midi endpoint monitor

Song Data

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.