From 1e09cb382568b5b0bafaaaeff3dc5913f744323e Mon Sep 17 00:00:00 2001 From: jimmy Date: Thu, 22 Oct 2026 12:33:43 +1300 Subject: [PATCH] Rename the MIDI intercept to padcontroller, as a module and as a service. Co-Authored-By: Claude Opus 5.5 --- Pipfile | 2 +- README.md | 12 ++++++------ padeditor/{intercept.py => padcontroller.py} | 6 +++--- padeditor/systemd/install.sh | 8 ++++---- ...pad-intercept.service => padcontroller.service} | 8 ++++---- scripts/pad/pad_lamps.py | 2 +- scripts/pad/patch_smc_pad.py | 2 +- scripts/pad/start_midi.sh | 14 +++++++------- scripts/shows/colour_sets.py | 6 +++--- 9 files changed, 30 insertions(+), 30 deletions(-) rename padeditor/{intercept.py => padcontroller.py} (97%) rename padeditor/systemd/{smc-pad-intercept.service => padcontroller.service} (60%) diff --git a/Pipfile b/Pipfile index d3bf0b4..6705ec6 100644 --- a/Pipfile +++ b/Pipfile @@ -14,5 +14,5 @@ python_version = "3.12" [scripts] midi = "python scripts/pad/midi.py" -intercept = "python -m padeditor.intercept" +padcontroller = "python -m padeditor.padcontroller" padeditor = "python -m padeditor" diff --git a/README.md b/README.md index b9fa07d..732eb51 100644 --- a/README.md +++ b/README.md @@ -51,19 +51,19 @@ python3 scripts/shows/figure8_small_eye.py --write-qxw shows/small_eye.qxw Copy `.qxf` files from `fixtures/` into QLC+’s fixture library if the manufacturer/model is missing. -## SMC-PAD intercept +## SMC-PAD pad controller -`padeditor.intercept` reads the SMC-PAD, smooths its knobs, applies the Play +`padeditor.padcontroller` reads the SMC-PAD, smooths its knobs, applies the Play layer, and sends the result on a virtual MIDI port named `SMC-PAD Smooth` for -QLC+. Run it by hand with `.venv/bin/python -m padeditor.intercept`, or install +QLC+. Run it by hand with `.venv/bin/python -m padeditor.padcontroller`, or install it as a systemd user service that starts at login and waits for the pad: ```bash padeditor/systemd/install.sh ``` -Options after the command go to the intercept (for example `--lock-knobs`). -`--uninstall` removes the service. Logs: `journalctl --user -u smc-pad-intercept -f`. +Options after the command go to the pad controller (for example `--lock-knobs`). +`--uninstall` removes the service. Logs: `journalctl --user -u padcontroller -f`. ## Chataigne @@ -77,7 +77,7 @@ python3 scripts/shows/make_chataigne.py shows/test.show.json chataigne/test Open `chataigne/test/test.noisette`. The **Pad** (MIDI) module reads the SMC-PAD directly (`--pad` picks the port: USB `SINCO SMC-PAD-Master` by default, or `SMC-PAD Bluetooth`). The script does the Play-layer shift that `padeditor/layer.py` does for -QLC+, with no knob smoothing, so the intercept is not needed. Set the lamps with +QLC+, with no knob smoothing, so the pad controller is not needed. Set the lamps with `scripts/pad/pad_lamps.py`. The **Lights** (DMX) module sends Art-Net to the node in the spec. The **Preview** module sends a copy to 127.0.0.1 for the simulator (`--preview ''` leaves it out). If it comes up on the wrong output, set DMX Type to Art-Net, the remote host, and an output universe of net 0, subnet 0, universe 0. diff --git a/padeditor/intercept.py b/padeditor/padcontroller.py similarity index 97% rename from padeditor/intercept.py rename to padeditor/padcontroller.py index 336e86b..1049b01 100644 --- a/padeditor/intercept.py +++ b/padeditor/padcontroller.py @@ -1,4 +1,4 @@ -"""Intercept the SMC-PAD's MIDI and smooth its knob CCs so RGBW fades feel less stepped. +"""Pad controller: intercept the SMC-PAD's MIDI and smooth its knob CCs so RGBW fades feel less stepped. Reads the physical pad (Bluetooth or USB), passes pad notes through immediately, and eases Control Change values toward their targets at @@ -9,10 +9,10 @@ bank 2 in the colours from shows/test.qxw. On Bluetooth it says so and carries o While Play is held, bank 2 notes 52–67 go out as 68–83 (see padeditor/layer.py). Point QLC+ MIDI input at that virtual port (midi.qxw does this via -patch_smc_pad.py once the intercept is running). +patch_smc_pad.py once the pad controller is running). Usage: - .venv/bin/python -m padeditor.intercept + .venv/bin/python -m padeditor.padcontroller # optional: --tau 0.05 (seconds; lower = snappier, higher = silkier) padeditor/systemd/install.sh runs it as a systemd user service. diff --git a/padeditor/systemd/install.sh b/padeditor/systemd/install.sh index 11d4a2d..1e1d62e 100755 --- a/padeditor/systemd/install.sh +++ b/padeditor/systemd/install.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash -# Install the SMC-PAD MIDI intercept as a systemd user service and start it. +# Install the SMC-PAD pad controller as a systemd user service and start it. # # padeditor/systemd/install.sh # install, enable, start -# padeditor/systemd/install.sh --lock-knobs # pass options to the intercept +# padeditor/systemd/install.sh --lock-knobs # pass options to the pad controller # padeditor/systemd/install.sh --uninstall # -# Logs: journalctl --user -u smc-pad-intercept -f +# Logs: journalctl --user -u padcontroller -f set -euo pipefail -UNIT=smc-pad-intercept.service +UNIT=padcontroller.service HERE="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$HERE/../.." && pwd)" DEST="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user" diff --git a/padeditor/systemd/smc-pad-intercept.service b/padeditor/systemd/padcontroller.service similarity index 60% rename from padeditor/systemd/smc-pad-intercept.service rename to padeditor/systemd/padcontroller.service index 71285e6..494c9ea 100644 --- a/padeditor/systemd/smc-pad-intercept.service +++ b/padeditor/systemd/padcontroller.service @@ -1,9 +1,9 @@ -# SMC-PAD MIDI intercept (padeditor.intercept) as a systemd user service. +# SMC-PAD pad controller (padeditor.padcontroller) as a systemd user service. # install.sh fills in @ROOT@, @PYTHON@ and @ARGS@ and copies it to # ~/.config/systemd/user/. [Unit] -Description=SMC-PAD MIDI intercept (virtual port "SMC-PAD Smooth") +Description=SMC-PAD pad controller (virtual port "SMC-PAD Smooth") After=sound.target # Keep retrying while the pad is switched off or not paired yet. StartLimitIntervalSec=0 @@ -11,9 +11,9 @@ StartLimitIntervalSec=0 [Service] Type=simple WorkingDirectory=@ROOT@ -ExecStart=@PYTHON@ -m padeditor.intercept @ARGS@ +ExecStart=@PYTHON@ -m padeditor.padcontroller @ARGS@ Environment=PYTHONUNBUFFERED=1 -# The intercept closes its ports on Ctrl+C. +# The pad controller closes its ports on Ctrl+C. KillSignal=SIGINT Restart=always RestartSec=3 diff --git a/scripts/pad/pad_lamps.py b/scripts/pad/pad_lamps.py index 14befae..448de18 100644 --- a/scripts/pad/pad_lamps.py +++ b/scripts/pad/pad_lamps.py @@ -3,7 +3,7 @@ .venv/bin/python scripts/pad/pad_lamps.py -Needs the USB Private port. padeditor.intercept does this on start; run this +Needs the USB Private port. padeditor.padcontroller does this on start; run this when the pad is read by Chataigne instead. """ diff --git a/scripts/pad/patch_smc_pad.py b/scripts/pad/patch_smc_pad.py index bc5307b..e3606e5 100644 --- a/scripts/pad/patch_smc_pad.py +++ b/scripts/pad/patch_smc_pad.py @@ -75,7 +75,7 @@ PAD_COLORS = [ def detect_midi_uid() -> str: - """Prefer smoothed virtual port when the intercept (padeditor.intercept) is running.""" + """Prefer smoothed virtual port when the pad controller (padeditor.padcontroller) is running.""" try: out = subprocess.check_output(["aconnect", "-l"], text=True) except (FileNotFoundError, subprocess.CalledProcessError): diff --git a/scripts/pad/start_midi.sh b/scripts/pad/start_midi.sh index 0e65981..fb8b068 100755 --- a/scripts/pad/start_midi.sh +++ b/scripts/pad/start_midi.sh @@ -3,7 +3,7 @@ # # Order matters: # 1) pad present (Bluetooth or USB) -# 2) intercept (creates "SMC-PAD Smooth") +# 2) pad controller (creates "SMC-PAD Smooth") # 3) patch workspace to that port # 4) open QLC+ last set -euo pipefail @@ -30,10 +30,10 @@ if ! pad_present; then exit 1 fi -# Restart the intercept so it re-opens the pad port cleanly. Use the systemd +# Restart the pad controller so it re-opens the pad port cleanly. Use the systemd # user service when it is installed (padeditor/systemd/install.sh). -SERVICE=smc-pad-intercept.service -LOG=/tmp/smc_pad_intercept.log +SERVICE=padcontroller.service +LOG=/tmp/padcontroller.log if systemctl --user is-enabled --quiet "$SERVICE" 2>/dev/null; then systemctl --user restart "$SERVICE" LOG= @@ -41,9 +41,9 @@ else # avoid pkill -f; it matches this script while read -r pid; do [[ -n "$pid" ]] && kill "$pid" 2>/dev/null || true - done < <(ps -eo pid,args | awk '/python.* -m padeditor[.]intercept/ {print $1}') + done < <(ps -eo pid,args | awk '/python.* -m padeditor[.]padcontroller/ {print $1}') sleep 0.4 - nohup "$PYTHON" -m padeditor.intercept --tau 0.055 >>"$LOG" 2>&1 & + nohup "$PYTHON" -m padeditor.padcontroller --tau 0.055 >>"$LOG" 2>&1 & fi for _ in $(seq 1 20); do if aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then @@ -52,7 +52,7 @@ for _ in $(seq 1 20); do sleep 0.25 done if ! aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then - echo "The intercept failed to create SMC-PAD Smooth." >&2 + echo "The pad controller failed to create SMC-PAD Smooth." >&2 if [[ -n "$LOG" ]]; then tail -20 "$LOG" >&2 || true else diff --git a/scripts/shows/colour_sets.py b/scripts/shows/colour_sets.py index f4441d5..cf0d64f 100644 --- a/scripts/shows/colour_sets.py +++ b/scripts/shows/colour_sets.py @@ -4,13 +4,13 @@ Colour 1 paints all 15 cans and colour 2 the four movers, so one colour for each can be on at once. Each set is a solo frame and every scene fades in and out over FADE_MS. Bank 2 (notes 52–67) picks colour 1. -Holding Play picks set B: the intercept turns those notes into 68–83 while +Holding Play picks set B: the pad controller turns those notes into 68–83 while Play is down. Bank 1 is kept for animations. python3 scripts/shows/colour_sets.py && python3 -m showfile write shows/test.show.json -o shows/test.qxw The sliders are Playback sliders over five scenes per set (Dim, R, G, B, W), so they never override a channel. Knobs 1–5 move colour 1's sliders and knobs -6–10 colour 2's. Run the intercept with --lock-knobs to make them work only +6–10 colour 2's. Run the pad controller with --lock-knobs to make them work only after the Custom pad is pressed; any other pad sends them back to zero (see padeditor/layer.py). """ @@ -31,7 +31,7 @@ PROFILE = "M-VAVE SMC-PAD" OMNI = 16 # QLC+ MIDI plugin channel that accepts every MIDI channel PAD_MIDI_CH = 9 # the pads send notes on channel 10 KNOB_FIRST_CC = 30 # pad knob 1; colour 2's sliders follow colour 1's -PAD_PORT = "SMC-PAD Smooth" # padeditor/intercept.py; it applies the Play layer +PAD_PORT = "SMC-PAD Smooth" # padeditor/padcontroller.py; it applies the Play layer # name, r, g, b, w. Bottom row first, four to a row. The cans have a white emitter, so the whites use it. COLOURS = (