This script maps MIDI Control Change (CC) and Note On/Off messages from a Behringer X-Touch Mini to vJoy virtual joystick inputs. It allows you to control vJoy axes and buttons using MIDI devices.
- Maps up to 8 MIDI CC messages to vJoy axes (X, Y, Z, RX, RY, RZ, SL0, SL1).
- Maps MIDI Note On/Off messages to vJoy buttons.
- Supports scaling MIDI CC values (0--127) to vJoy axis range (0--32,767).
- Designed for compatibility with the Behringer X-Touch Mini.
- A MIDI device (e.g., Behringer X-Touch Mini).
- Python 3.7 or newer.
- The following Python packages:
mido
(for MIDI input handling)pyvjoy
(for interacting with vJoy)
To install the required Python packages, use:
pip install mido pyvjoy `
- vJoy Virtual Joystick Driver. Ensure vJoy is installed and configured with a virtual joystick.
-
pip install Xtouch2Vjoy
- Ensure Python and required libraries are installed.
- Verify your vJoy configuration supports the required axes and buttons.
-
Connect your MIDI device (e.g., Behringer X-Touch Mini) to your computer.
-
Run the script:
bash
Copy code
python script.py
-
Select the MIDI port:
- The script lists all available MIDI input ports.
- Enter the number corresponding to your device.
-
Interact with your MIDI device:
- Turn knobs or sliders to send CC messages, mapped to vJoy axes.
- Press buttons to trigger Note On/Off messages, mapped to vJoy buttons.
MIDI CC Number | vJoy Axis | Description |
---|---|---|
CC1 | X | X-axis |
CC2 | Y | Y-axis |
CC3 | Z | Z-axis |
CC4 | RX | Rotational X |
CC5 | RY | Rotational Y |
CC6 | RZ | Rotational Z |
CC7 | SL0 | Slider 0 |
CC9 | SL1 | Slider 1 |
- MIDI Notes are mapped to vJoy buttons sequentially.
- For example, MIDI Note 0 triggers vJoy Button 1, Note 1 triggers Button 2, etc.
- vJoy supports a maximum of 8 axes, which restricts the number of mappable CC controls.
- CC8 is disabled in this implementation due to this limitation.
- Ensure your MIDI device is sending the expected CC messages for proper mapping.
- The script prints incoming MIDI messages to the console.
- It also logs the mapping of CC messages and button presses for troubleshooting.