midi2hid
Maps MIDI input to keyboard, mouse and gamepad input, so a MIDI keyboard, pad controller or knob box can play games and drive other software. A note, a chord, a run of notes or a turned knob becomes a key press, a key combination, a mouse action or a short macro.
How it fits together
It is written in Rust as a set of small crates. Splitting it into processes lets the part that reads MIDI run on the machine the controller is plugged into while the part that types runs on the machine with the game. The desktop interface is written with Dioxus and the terminal one with ratatui; both can record a trigger by listening for what you play.
Mappings
Triggers
- Note: one key, with an optional minimum velocity.
- Chord: several keys held together within a time window.
- Sequence: keys in order, with a maximum gap between them.
- Control change: a knob or fader crossing a threshold, optionally in one direction.
Actions
- a key press or a key combination;
- mouse clicks, movement and scrolling;
- a knob or fader driving a stick or the mouse continuously;
- a macro of timed steps;
- gamepad buttons and stick axes (Linux only, see below).
Mappings are grouped into profiles kept in TOML, one per game or task, and switched from the interface or by a configured MIDI input. Three profiles come with it: a getting-started set, media controls, and the movement-and-combat layout below.
presets/wasd-gaming.toml# WASD Gaming — MIDI notes mapped to WASD movement and common game keys.
#
# Lower octave (C3–B3, MIDI 48–59) handles movement and combat.
# Upper octave (C4–B4, MIDI 60–71) handles utility and menu keys.
[profile]
name = "WASD Gaming"
description = "MIDI notes mapped to WASD + common game keys for keyboard-based games"
# --- Movement (C3 octave) ---
[[mapping]]
label = "C3 -> W (forward)"
[mapping.trigger.note]
note = 48
[mapping.action.keypress]
key = "W"
[[mapping]]
label = "D3 -> A (left)"
[mapping.trigger.note]
note = 50
[mapping.action.keypress]
key = "A"Platforms
| Platform | Keyboard and mouse | Gamepad |
|---|---|---|
| Linux | uinput virtual devices | a virtual Xbox-style gamepad through uinput |
| macOS | CGEvent | not yet: logs a warning |
| Windows | SendInput | not yet: a virtual pad through ViGEmBus is planned |
The specification describes gamepad output through Steam Input on every platform; that is not implemented. The repository and its release downloads are private.