#midi #music #sound #api-bindings

midir

A cross-platform, realtime MIDI processing library, inspired by RtMidi

22 releases

new 0.11.0 Apr 18, 2026
0.10.3 Oct 27, 2025
0.10.1 Nov 20, 2024
0.10.0 Apr 21, 2024
0.1.2 Oct 21, 2015

#12 in Audio

Download history 3217/week @ 2025-12-27 4446/week @ 2026-01-03 3717/week @ 2026-01-10 4654/week @ 2026-01-17 4789/week @ 2026-01-24 6142/week @ 2026-01-31 5989/week @ 2026-02-07 6092/week @ 2026-02-14 6633/week @ 2026-02-21 6899/week @ 2026-02-28 6606/week @ 2026-03-07 8685/week @ 2026-03-14 7372/week @ 2026-03-21 7278/week @ 2026-03-28 8712/week @ 2026-04-04 8146/week @ 2026-04-11

33,015 downloads per month
Used in 106 crates (88 directly)

MIT license

165KB
4K SLoC

midir crates.io

Cross-platform, realtime MIDI processing in Rust.

Features

midir is inspired by RtMidi and supports the same features*, including virtual ports (except on Windows) and full SysEx support – but with a rust-y API!

* With the exception of message queues, but these can be implemented on top of callbacks using e.g. Rust's channels.

midir currently supports the following platforms/backends:

  • ALSA (Linux)
  • WinMM (Windows)
  • CoreMIDI (macOS, iOS)
  • WinRT (Windows 8+), enable the winrt feature
  • Jack (Linux, macOS), enable the jack feature
  • Web MIDI (Chrome, Opera, perhaps others browsers)
  • Android (API 29+, NDK AMidi + JNI)

A higher-level API for parsing and assembling MIDI messages might be added in the future.

Documentation & Example

API docs can be found at docs.rs. You can find some examples in the examples directory. Or simply run cargo run --example test_play after cloning this repository.

Android

  • Requires Android API 29+ and the Android NDK (r20b+).
  • Build (example, to remove before merging):
    • Install: cargo install cargo-ndk
    • Targets: rustup target add aarch64-linux-android
    • Build: cargo ndk -t arm64-v8a -o ./app/src/main/jniLibs build --release
  • Permissions/features:
    • Manifest should declare <uses-feature android:name="android.software.midi" android:required="false" /> (not needed for USB/BLE MIDI).

Dependencies

~0–42MB
~566K SLoC