Convert WT9011DCL motion sensor data to MIDI for music production.
You can buy a sensor here: https://witmotion-sensor.com/products/wt9011dcl-bluetooth5-0-compact-size-accelerometer-inclinometer-sensor
- WT9011DCL motion sensor support:
- Acceleration, angular velocity, and orientation data
- Real-time wireless data transmission at 100Hz
- Two output modes:
midi: MIDI output for DAW integration (default)plot: Live graphical plotting
- Automatic sensor discovery with retry logic
- Cross-platform support (macOS, Windows, Linux)
This project uses uv for Python package management:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync# Connect to motion sensor (MIDI CC mode - default)
uv run motion.py
# Connect with specific modes
uv run motion.py plot # Live plotting
uv run motion.py notes # MIDI CC + note triggersuv run motion.pySends sensor data as MIDI Control Changes.
uv run motion.py notesMIDI CC output plus note triggering with deadband hysteresis. Notes trigger when acceleration exceeds upper threshold (1.5g) and reset when it drops below lower threshold (0.75g).
uv run motion.py plotLive graphical plotting of sensor data with separate subplots for acceleration, angular velocity, and angles.
MIDI CC Mapping:
- CC#20: Adjusted acceleration magnitude
- CC#21: Angular velocity magnitude
- CC#22-24: Raw acceleration X, Y, Z
- CC#25-27: Raw angular velocity X, Y, Z
- CC#28-30: Raw angles (Roll, Pitch, Yaw)
It just works, without any extra setup, because Mac has a built in virtual midi port.
Windows doesn't support virtual MIDI ports natively. You need to install a virtual MIDI driver:
Option 1: loopMIDI (Recommended)
- Download from: https://www.tobias-erichsen.de/software/loopmidi.html
- Install and run loopMIDI
- Click "+" to create a new virtual port
- The port will appear in your DAW and the Python scripts
Option 2: MIDI Yoke
- Download from: http://www.midiox.com/myoke.htm
- Install and restart your computer
- MIDI Yoke ports will be available system-wide
Most Linux distributions support virtual MIDI ports through ALSA:
# Load the virtual MIDI module
sudo modprobe snd-virmidi- Run the MIDI script
- In your DAW, select the virtual MIDI port as input
- Use MIDI Learn to map CCs to synthesizer parameters
bleak: Bluetooth LE communicationnumpy: Numerical computingmatplotlib: Real-time plottingpython-rtmidi: MIDI output