Python library for controlling the Native Instruments Maschine MK1 controller on Linux.
- Full LED control for all 16 pads + transport buttons + group buttons
- 255x64 pixel LCD display support
- Input handling for pads, buttons, knobs, and encoders
- Startup animation sequences
- MIDI support
pip install -e .# Test LEDs
python -m tests.test_leds
# Test display
python -m tests.test_display
# Simple demo
python main.pyfrom maschine import MaschineLED, run_startup
led = MaschineLED()
led.init()
# Run startup animation
run_startup(led)
# Control LEDs
led.set_pad_led(0, 255) # Pad 1 at full brightness
led.set_button_led("Play", 128)
led.close()- Linux (ubuntu 25.10 or similar)
- Python 3.13+
- Native Instruments Maschine MK1 controller
- libusb (via hidapi-libusb)
- librtmidi (7)
Allow access to the device
sudo usermod -a -G plugdev $USER
Check if librtmidi.so.7 was installed
ldconfig -p | grep rtmdidi
if no, you might need to install or upgrade sudo apt-get install librtmidi
Create a udev rule to automatically run the script when the Maschine MK1 is connected via USB:
-
Find the device vendor/product ID:
lsusb | grep -i maschineThe Maschine MK1 typically shows as
17cc:__(Vendor ID: 17cc, Product ID: varies) -
Create a udev rule file:
sudo nano /etc/udev/rules.d/99-maschine.rules
-
Add the following rule (replace
17cc:____with your device ID):SUBSYSTEM=="usb", ATTR{idVendor}=="17cc", ATTR{idProduct}=="____", MODE="0666", GROUP="plugdev", ACTION=="add", RUN+="/usr/bin/su -c '/projects/pushb/controller/main.py' - username"Or use a systemd service for better reliability:
SUBSYSTEM=="usb", ATTR{idVendor}=="17cc", ATTR{idProduct}=="____", TAG+="systemd", ENV{SYSTEMD_WANTS}="maschine.service" -
Create the systemd service:
sudo nano /etc/systemd/system/maschine.service
[Unit] Description=Maschine MK1 Controller After=local-fs.target [Service] Type=simple User=username WorkingDirectory=/projects/pushb/controller ExecStart=/usr/bin/python3 /projects/pushb/controller/main.py Restart=on-failure [Install] WantedBy=multi-user.target
-
Reload udev and enable the service:
sudo udevadm control --reload-rules sudo systemctl daemon-reload sudo systemctl enable maschine.service -
Plug in the Maschine device - the script should start automatically.
- cablpy.so was built for Linux x86-64 with Python 3.13
- It will work on any Linux x86_64 system with Python 3.13 and the required system libraries
MIT
