A Python application that allows you to control video games using MIDI controllers, specifically designed for the Pioneer XDJ-RX but compatible with any MIDI device.
This project converts MIDI messages from your DJ controller into keyboard and mouse inputs, allowing you to play video games using your Pioneer XDJ-RX or any other MIDI controller. The system is modular, with separate game profiles for different titles.
Control classic Doom using your MIDI controller:
- CUE Button (Note 1): Left click (shooting)
- PLAY Button (Note 0): Space bar (use/open doors)
- Pitch Control (CC 29): Forward/backward movement (Up/Down arrows)
- Jog Control (CC 16): Strafing left/right (Left/Right arrows)
- Control 17: Shift key (running)
Control Minecraft with your MIDI controller:
- CUE Button (Note 1): Left click (mining/attacking)
- PLAY Button (Note 0): Space bar (jumping)
- Pitch Control (CC 29): Forward/backward movement (W/S keys)
- Jog Control (CC 16): Mouse movement for looking around
The project is specifically designed for the Pioneer XDJ-RX controller, but the MIDI reader can handle any MIDI device. The XDJ-RX provides:
- CUE Buttons: Used for primary actions (shooting, mining)
- PLAY Button: Used for secondary actions (jumping, using items)
- Pitch Control: Used for forward/backward movement
- Jog Wheels: Used for turning/strafing
The midi_reader.py file serves as a general-purpose MIDI receiver that can:
- Automatically detect available MIDI input ports
- Handle any MIDI device connected to your system
- Convert MIDI messages to keyboard and mouse inputs
- Clone this repository:
git clone <repository-url>
cd midi_receiver- Install required dependencies:
pip install -r requirements.txtTo control a specific game, run the corresponding game file:
# For Doom
python games/doom.py
# For Minecraft
python games/minecraft.pyFor general MIDI control or to test your controller:
python midi_reader.py- Connect your Pioneer XDJ-RX (or any MIDI controller) to your computer
- Ensure the controller is recognized by your system
- Run the desired game file
- The application will automatically detect and list available MIDI ports
- Start playing!
You can modify the control mappings by editing the handle_midi_message() function in each game file. The system supports:
- Note On/Off messages: For button presses
- Control Change messages: For continuous controls (knobs, faders, jog wheels)
- Velocity values: For pressure-sensitive controls
- Python 3.6+
mido==1.3.0- MIDI I/O librarypynput==1.7.6- Keyboard and mouse control- A MIDI controller (Pioneer XDJ-RX recommended)
- Ensure your controller is properly connected
- Check that your controller is in MIDI mode
- Verify USB drivers are installed
- Make sure the game window is active/focused
- Check that the correct MIDI port is being used
- Verify the game supports the keyboard/mouse inputs being sent
You may need to grant accessibility permissions to Python for keyboard/mouse control:
- macOS: System Preferences → Security & Privacy → Privacy → Accessibility
- Linux: May require running with
sudoor configuring X11 permissions
To add support for a new game:
- Create a new file in the
games/directory - Copy the structure from an existing game file
- Modify the
handle_midi_message()function for your game's controls - Update this README with the new game's information