Skip to content

A Python application that converts MIDI controller from XDJ-RX inputs into keyboard and mouse controls for video games. Specifically designed for the Pioneer XDJ-RX DJ controller but compatible with any MIDI device. Currently supports Doom and Minecraft with modular game profiles for easy customization.

Notifications You must be signed in to change notification settings

hPerezz/midi-game-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIDI Receiver

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.

Overview

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.

Supported Games

🎮 Doom (games/doom.py)

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)

⛏️ Minecraft (games/minecraft.py)

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

MIDI Controller Compatibility

Primary Controller: Pioneer XDJ-RX

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

Universal MIDI Support

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

Installation

  1. Clone this repository:
git clone <repository-url>
cd midi_receiver
  1. Install required dependencies:
pip install -r requirements.txt

Usage

Running a Specific Game

To control a specific game, run the corresponding game file:

# For Doom
python games/doom.py

# For Minecraft
python games/minecraft.py

Using the General MIDI Reader

For general MIDI control or to test your controller:

python midi_reader.py

Connecting Your Controller

  1. Connect your Pioneer XDJ-RX (or any MIDI controller) to your computer
  2. Ensure the controller is recognized by your system
  3. Run the desired game file
  4. The application will automatically detect and list available MIDI ports
  5. Start playing!

Customizing Controls

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

Requirements

  • Python 3.6+
  • mido==1.3.0 - MIDI I/O library
  • pynput==1.7.6 - Keyboard and mouse control
  • A MIDI controller (Pioneer XDJ-RX recommended)

Troubleshooting

No MIDI Ports Detected

  • Ensure your controller is properly connected
  • Check that your controller is in MIDI mode
  • Verify USB drivers are installed

Controls Not Responding

  • 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

Permission Issues (macOS/Linux)

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 sudo or configuring X11 permissions

Contributing

To add support for a new game:

  1. Create a new file in the games/ directory
  2. Copy the structure from an existing game file
  3. Modify the handle_midi_message() function for your game's controls
  4. Update this README with the new game's information

About

A Python application that converts MIDI controller from XDJ-RX inputs into keyboard and mouse controls for video games. Specifically designed for the Pioneer XDJ-RX DJ controller but compatible with any MIDI device. Currently supports Doom and Minecraft with modular game profiles for easy customization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages