Skip to main content

flx4py

Python library for the Pioneer DDJ-FLX4 DJ controller.

Full programmatic access to every button, knob, fader, jog wheel, and LED on the device — with a clean, callback-based API.

import flx4py

controller = flx4py.DDJFlx4()

@controller.on_pad(deck=1, pressed=True)
def pad_pressed(event: flx4py.PadEvent):
    controller.leds.set_pad(event.deck, event.pad, True)

@controller.on_knob("CROSSFADER")
def crossfader(event: flx4py.KnobEvent):
    controller.leds.set_level_meter(1, event.value)
    controller.leds.set_level_meter(2, 1.0 - event.value)

with controller:
    import time
    while True:
        time.sleep(1)

Install

pip install flx4py

Requires Python 3.10+ and a DDJ-FLX4 connected over USB.

Features

  • Callbacks for pads, buttons, knobs, faders, jog wheels, and the browse encoder
  • LED control for pads (all modes), transport buttons, tab keys, FX buttons, and VU meters
  • Built-in animations — wave, knight rider, breathing, sparkle, ping pong, rainbow chase
  • Current value queries — ask for the last known position of any knob or fader
  • 14-bit resolution for faders and knobs
  • Context manager for clean resource management

Documentation

Full docs at trc-loop.github.io/flx4py

Quick reference

# Pads
@controller.on_pad(deck=1, pressed=True)
def handler(event: flx4py.PadEvent): ...

# Buttons
@controller.on_button("PLAY_PAUSE", deck=1, pressed=True)
def handler(event: flx4py.ButtonEvent): ...

# Knobs / faders
@controller.on_knob("CH_FADER", deck=1)
def handler(event: flx4py.KnobEvent): ...  # event.value = 0.0–1.0

# Jog wheels
@controller.on_jog(deck=1, surface="top")
def handler(event: flx4py.JogEvent): ...  # event.direction = +1 or -1

# Browse encoder
@controller.on_browse()
def handler(event: flx4py.BrowseEvent): ...  # event.steps = ±n

# LEDs
controller.leds.set_pad(deck=1, pad=0, on=True)
controller.leds.set_button("PLAY_PAUSE", on=True, deck=1)
controller.leds.set_level_meter(deck=1, level=0.75)
controller.leds.all_off()

# Query current values
fader = controller.get_value("CH_FADER", deck=1)    # 0.0–1.0
tempo = controller.get_value("TEMPO", deck=1)        # -1.0–1.0
cross = controller.get_value("CROSSFADER")           # 0.0–1.0

License

MIT

Release files for flx4py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flx4py 0.1.0
File Size Uploaded
flx4py-0.1.0.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flx4py 0.1.0
File Interpreter ABI Platform
flx4py-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / flx4py-0.1.0.tar.gz

Download URL flx4py-0.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e08a003815b77f3421e262824d369db49f48ec9dbefc1491f44767c71e62f97b
BLAKE2b-256 checksum
How to use checksums
8946282eb3b347dd255ba972d3a094f8e50aab38faed543cc48bcce20af113d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.12.2 Darwin/25.3.0

Release files / flx4py-0.1.0-py3-none-any.whl

Download URL flx4py-0.1.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03148c4b132bd92a962749772ee7a50573bcf565ba296bc30eaa447f7a9ed128
BLAKE2b-256 checksum
How to use checksums
13eb368ad8e66a13e78e616c23b306afd3373f6895294db6a14494a683cdcad4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.12.2 Darwin/25.3.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page