Skip to main content

Python library for the Pioneer DDJ-FLX4 DJ controller.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flx4py-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flx4py-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file flx4py-0.1.0.tar.gz.

File metadata

  • Download URL: flx4py-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.2 Darwin/25.3.0

File hashes

Hashes for flx4py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e08a003815b77f3421e262824d369db49f48ec9dbefc1491f44767c71e62f97b
MD5 6ef1147cc3cedc54a607fe89cc518ab4
BLAKE2b-256 8946282eb3b347dd255ba972d3a094f8e50aab38faed543cc48bcce20af113d8

See more details on using hashes here.

File details

Details for the file flx4py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flx4py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.2 Darwin/25.3.0

File hashes

Hashes for flx4py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03148c4b132bd92a962749772ee7a50573bcf565ba296bc30eaa447f7a9ed128
MD5 b665d0130812707632cedaf7506ed3d1
BLAKE2b-256 13eb368ad8e66a13e78e616c23b306afd3373f6895294db6a14494a683cdcad4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page