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

Four processes and a launcher midi2hid's processes. midi2hid-listen reads one or more MIDI devices and forwards their events to the daemon. midi2hid-daemon holds the profiles and their mappings, matches incoming notes, chords, sequences and control changes against triggers, and sends output commands to midi2hid-hid, which turns them into keyboard, mouse or gamepad input through the operating system. A terminal or desktop interface edits the mappings live. They talk in length-prefixed bincode frames over Unix sockets on one machine or TCP between machines, so the MIDI device and the game can be on different computers. The launcher starts them all and opens the interface. MIDI devicekeys · pads · knobs midi2hid-listenone per device midi2hid-daemonprofiles · matching midi2hid-hidkeyboard · mouse · pad TUI or GUIratatui · Dioxus midi2hidlauncher: starts the rest MIDI events output edit live

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

PlatformKeyboard and mouseGamepad
Linuxuinput virtual devicesa virtual Xbox-style gamepad through uinput
macOSCGEventnot yet: logs a warning
WindowsSendInputnot 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.