MCPcopy Index your code
hub / github.com/Boddlnagg/midir

github.com/Boddlnagg/midir @v0.11.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.11.0 ↗ · + Follow
252 symbols 448 edges 25 files 36 documented · 14% updated 2mo ago★ 81431 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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: - [x] ALSA (Linux) - [x] WinMM (Windows) - [x] CoreMIDI (macOS, iOS) - [x] WinRT (Windows 8+), enable the winrt feature - [x] Jack (Linux, macOS), enable the jack feature - [x] Web MIDI (Chrome, Opera, perhaps others browsers) - [x] 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).

Extension points exported contracts — how you extend this code

MidiIO (Interface)
Trait that abstracts over input and output ports. [2 implementers]
src/common.rs
VirtualInput (Interface)
Trait that is implemented by `MidiInput` on platforms that support virtual ports (currently every platform but Windows). [1 …
src/os/unix.rs
VirtualOutput (Interface)
Trait that is implemented by `MidiOutput` on platforms that support virtual ports (currently every platform but Windows) [1 …
src/os/unix.rs

Core symbols most depended-on inside this repo

contains
called by 30
src/lib.rs
send
called by 18
src/common.rs
ports
called by 13
src/common.rs
connect
called by 10
src/common.rs
clear
called by 10
src/backend/jack/wrappers.rs
close
called by 9
src/common.rs
get
called by 8
src/backend/alsa/mod.rs
ignore
called by 7
src/common.rs

Shape

Method 134
Class 72
Function 37
Enum 6
Interface 3

Languages

Rust100%

Modules by API surface

src/backend/alsa/mod.rs35 symbols
src/backend/jack/wrappers.rs28 symbols
src/backend/winmm/mod.rs27 symbols
src/backend/android/mod.rs26 symbols
src/backend/jack/mod.rs23 symbols
src/common.rs21 symbols
src/backend/coremidi/mod.rs21 symbols
src/backend/winrt/mod.rs18 symbols
src/backend/webmidi/mod.rs17 symbols
src/errors.rs10 symbols
src/lib.rs5 symbols
examples/test_forward.rs3 symbols

For agents

$ claude mcp add midir \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact