Group scripts into pad/, shows/ and anim/ folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-10-22 11:54:36 +13:00
1 parent 5f593b973c
commit 647cfa3a75
26 files changed
+68 -66

No files matched your search

+1 -3
View File
@@ -13,7 +13,5 @@ python-rtmidi = "*"
python_version = "3.12"
[scripts]
positions = "python scripts/position_movers.py"
pattern = "python -m pattern_pad"
midi = "python scripts/midi.py"
midi = "python scripts/pad/midi.py"
padeditor = "python -m padeditor"
+11 -8
View File
@@ -12,7 +12,10 @@ shows/ Workspaces to open in QLC+
simple.qxw Manual board: M1/M2 pads, shared + individual RGBW
small_eye.qxw Movers-only figure-of-8 show
archive/ Older scratch workspaces
scripts/ Generators / patchers for the shows
scripts/ Launchers (pattern_studio.sh, flash_luxdmx_xiao.sh)
pad/ SMC-PAD tools: smoother, Play layer, lamps, MIDI patching
shows/ Generators / patchers for the shows and Chataigne
anim/ showfile animations to preview over Art-Net
stage/ Stage map (SVG, JSON, canvas)
tests/ Art-Net / fixture helpers used by scripts
```
@@ -26,16 +29,16 @@ tests/ Art-Net / fixture helpers used by scripts
```bash
# Rebuild simple manual board
python3 scripts/make_simple_vc.py
python3 scripts/shows/make_simple_vc.py
# Rewrite can/mover patterns from stage layout
python3 scripts/integrate_u_patterns.py
python3 scripts/shows/integrate_u_patterns.py
# Unify Patterns + Movers into one Show frame
python3 scripts/unify_vc.py
python3 scripts/shows/unify_vc.py
# Figure-of-8 (live Art-Net or write/merge workspace)
python3 scripts/figure8_small_eye.py --write-qxw shows/small_eye.qxw
python3 scripts/shows/figure8_small_eye.py --write-qxw shows/small_eye.qxw
```
## Fixtures / DMX
@@ -50,18 +53,18 @@ manufacturer/model is missing.
## Chataigne
`scripts/make_chataigne.py` turns a show spec into a Chataigne project, so the
`scripts/shows/make_chataigne.py` turns a show spec into a Chataigne project, so the
SMC-PAD can drive the same colour pads and sliders without QLC+.
```bash
python3 scripts/make_chataigne.py shows/test.show.json chataigne/test
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 `pad_layer.py` does for
QLC+, with no knob smoothing, so `smooth_smc_pad.py` is not needed. Set the lamps with
`scripts/pad_lamps.py`. The **Lights** (DMX) module sends Art-Net to the
`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.
The project also has a dashboard with the same buttons and sliders as the
+2 -2
View File
@@ -1,7 +1,7 @@
// Pads pick colours, sliders mix a custom colour, like the QLC+ virtual console.
// It reads the pad directly: Play shifts bank 2 here, as scripts/pad_layer.py does
// It reads the pad directly: Play shifts bank 2 here, as scripts/pad/pad_layer.py does
// when QLC+ is used.
// Generated by scripts/make_chataigne.py: edit this template, not the output.
// Generated by scripts/shows/make_chataigne.py: edit this template, not the output.
//
// Runs as a script on the MIDI module "Pad" so it gets the pad and knob events.
// DMX goes out through the DMX module "Lights", and a copy through "Preview" if it exists.
+2 -2
View File
@@ -1,7 +1,7 @@
// Pads pick colours, sliders mix a custom colour, like the QLC+ virtual console.
// It reads the pad directly: Play shifts bank 2 here, as scripts/pad_layer.py does
// It reads the pad directly: Play shifts bank 2 here, as scripts/pad/pad_layer.py does
// when QLC+ is used.
// Generated by scripts/make_chataigne.py: edit this template, not the output.
// Generated by scripts/shows/make_chataigne.py: edit this template, not the output.
//
// Runs as a script on the MIDI module "Pad" so it gets the pad and knob events.
// DMX goes out through the DMX module "Lights", and a copy through "Preview" if it exists.
@@ -3,12 +3,12 @@
Dry run (prints DMX samples, sends nothing):
python3 scripts/anim_eight.py
python3 -m showfile run scripts/anim_eight.py --seconds 1
python3 scripts/anim/anim_eight.py
python3 -m showfile run scripts/anim/anim_eight.py --seconds 1
Send Art-Net, for example at the stage simulator:
python3 scripts/anim_eight.py --ip 127.0.0.1 --seconds 8
python3 scripts/anim/anim_eight.py --ip 127.0.0.1 --seconds 8
"""
from __future__ import annotations
@@ -16,7 +16,7 @@ from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
@@ -5,12 +5,12 @@ The patch, positions, and channel names come from stage/map.json.
Dry run (prints DMX samples, sends nothing):
python3 scripts/anim_stage.py
python3 -m showfile run scripts/anim_stage.py --seconds 1
python3 scripts/anim/anim_stage.py
python3 -m showfile run scripts/anim/anim_stage.py --seconds 1
Send Art-Net at the stage simulator:
python3 scripts/anim_stage.py --ip 127.0.0.1 --seconds 12
python3 scripts/anim/anim_stage.py --ip 127.0.0.1 --seconds 12
"""
from __future__ import annotations
@@ -18,7 +18,7 @@ from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
@@ -2,7 +2,7 @@
"""Print the SMC-PAD SysEx in a usbmon capture.
sudo tcpdump -i usbmon1 -s 0 -U -w - > captures/pad.pcap
python3 scripts/decode_usbmon.py captures/pad.pcap --device 21
python3 scripts/pad/decode_usbmon.py captures/pad.pcap --device 21
Each USB-MIDI packet is reassembled into messages per cable, then SINCO
SysEx is decoded to its command, memory, address, and data.
@@ -15,7 +15,7 @@ import struct
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from padeditor.sysex import decode # noqa: E402
+2 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Print SMC-PAD pad and knob numbers.
pipenv run python scripts/midi.py
pipenv run python scripts/pad/midi.py
Each pad press prints pad N. Each knob turn prints knob N and its step
(+ for up, - for down).
@@ -18,7 +18,7 @@ from pathlib import Path
import mido
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
MAP_PATH = ROOT / "shows" / "midi_map.json"
# (channel, note) -> pad number. Loaded from shows/midi_map.json.
@@ -5,11 +5,11 @@ Pad bank 1 is notes 36–51 and pad bank 2 is notes 52–67, bottom-left
first. Note messages do not change these lamps. The colour is three
bytes in the preset, written over the Private USB port.
.venv/bin/python scripts/pad_colours.py --xchc --bank 2
.venv/bin/python scripts/pad_colours.py --colour-set --bank 2
.venv/bin/python scripts/pad_colours.py --dry-run
.venv/bin/python scripts/pad_colours.py --clear
.venv/bin/python scripts/pad_colours.py --identify
.venv/bin/python scripts/pad/pad_colours.py --xchc --bank 2
.venv/bin/python scripts/pad/pad_colours.py --colour-set --bank 2
.venv/bin/python scripts/pad/pad_colours.py --dry-run
.venv/bin/python scripts/pad/pad_colours.py --clear
.venv/bin/python scripts/pad/pad_colours.py --identify
--identify lights every pad on a page in that page's colour, in rainbow
order, in all eight presets, so the page on show can be read at a glance.
@@ -27,9 +27,9 @@ import glob
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
sys.path.insert(0, str(ROOT / "scripts"))
sys.path.insert(0, str(ROOT / "scripts" / "pad"))
from patch_smc_pad import PAD_COLORS # noqa: E402
from padeditor import preset # noqa: E402
@@ -120,6 +120,7 @@ def xchc_colours(clear: bool = False) -> list[tuple[str, bytes]]:
def colour_set(clear: bool = False) -> list[tuple[str, bytes]]:
"""The colours of shows/test.qxw in pad order, then the rest of the bank off."""
sys.path.insert(0, str(ROOT / "scripts" / "shows"))
from colour_sets import COLOURS
colours = []
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Set the SMC-PAD lamps: bank 1 off, bank 2 in the colours of shows/test.qxw.
.venv/bin/python scripts/pad_lamps.py
.venv/bin/python scripts/pad/pad_lamps.py
Needs the USB Private port. smooth_smc_pad.py does this on start; run this
when the pad is read by Chataigne instead.
@@ -12,13 +12,13 @@ from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
def set_lamps() -> None:
"""Bank 1 lamps off, bank 2 lamps from shows/test.qxw. Needs the USB Private port."""
sys.path.insert(0, str(ROOT))
sys.path.insert(0, str(ROOT / "scripts"))
sys.path.insert(0, str(ROOT / "scripts" / "pad"))
import pad_colours
try:
File renamed without changes.
@@ -8,7 +8,7 @@ import shutil
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
OUT = ROOT / "shows" / "midi.qxw"
PROFILE_SRC = ROOT / "inputprofiles" / "M-VAVE-SMC-PAD.qxi"
PROFILE_DST = Path.home() / ".qlcplus" / "inputprofiles" / "M-VAVE-SMC-PAD.qxi"
@@ -13,7 +13,7 @@ Point QLC+ MIDI input at that virtual port (midi.qxw does this via
patch_smc_pad.py once the smoother is running).
Usage:
.venv/bin/python scripts/smooth_smc_pad.py
.venv/bin/python scripts/pad/smooth_smc_pad.py
# optional: --tau 0.05 (seconds; lower = snappier, higher = silkier)
"""
@@ -27,7 +27,7 @@ import sys
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
import glob
for p in glob.glob(str(ROOT / ".venv" / "lib" / "python*" / "site-packages")):
@@ -7,7 +7,7 @@
# 3) patch workspace to that port
# 4) open QLC+ last
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$ROOT"
PYTHON="${ROOT}/.venv/bin/python"
@@ -35,7 +35,7 @@ while read -r pid; do
[[ -n "$pid" ]] && kill "$pid" 2>/dev/null || true
done < <(ps -eo pid,args | awk '/[.]venv\/bin\/python .*smooth_smc_pad[.]py/ {print $1}')
sleep 0.4
nohup "$PYTHON" scripts/smooth_smc_pad.py --tau 0.055 >>/tmp/smooth_smc_pad.log 2>&1 &
nohup "$PYTHON" scripts/pad/smooth_smc_pad.py --tau 0.055 >>/tmp/smooth_smc_pad.log 2>&1 &
for _ in $(seq 1 20); do
if aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then
break
@@ -48,7 +48,7 @@ if ! aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then
exit 1
fi
python3 scripts/patch_smc_pad.py
python3 scripts/pad/patch_smc_pad.py
kill "$(pgrep -x qlcplus)" 2>/dev/null || true
sleep 0.5
@@ -7,7 +7,7 @@ fades in and out over FADE_MS. Bank 2 (notes 52–67) picks colour 1.
Holding Play picks set B: the smoother turns those notes into 68–83 while
Play is down. Bank 1 is kept for animations.
python3 scripts/colour_sets.py && python3 -m showfile write shows/test.show.json -o shows/test.qxw
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 smoother with --lock-knobs to make them work only
@@ -20,18 +20,18 @@ from __future__ import annotations
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
SPEC = ROOT / "shows" / "test.show.json"
FADE_MS = 1000
DIMMER, RED, GREEN, BLUE, WHITE = 0, 2, 3, 4, 5
PAD_BANK_2_FIRST_NOTE = 52
HELD_FIRST_NOTE = 68 # scripts/pad_layer.py sends bank 2 here while Play is held
HELD_FIRST_NOTE = 68 # scripts/pad/pad_layer.py sends bank 2 here while Play is held
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" # scripts/smooth_smc_pad.py; it applies the Play layer
PAD_PORT = "SMC-PAD Smooth" # scripts/pad/smooth_smc_pad.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 = (
@@ -5,9 +5,9 @@ Traces QLC+'s Eight path (pan = -sin(2t), tilt = cos(t)), rides focus
with throw so the spot stays a similar size, and walks hue around the loop.
The whole 8 slowly drifts in a circle so it does not sit in one place.
python3 scripts/figure8_small_eye.py
python3 scripts/figure8_small_eye.py --write-qxw shows/small_eye.qxw
python3 scripts/figure8_small_eye.py --merge-xchc shows/xchc.qxw
python3 scripts/shows/figure8_small_eye.py
python3 scripts/shows/figure8_small_eye.py --write-qxw shows/small_eye.qxw
python3 scripts/shows/figure8_small_eye.py --merge-xchc shows/xchc.qxw
Stop QLC+ output before live mode so the two sources do not fight.
Quit live mode with Ctrl+C (sends blackout).
@@ -22,7 +22,7 @@ import sys
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT / "tests"))
from test_small_eye import (
@@ -182,7 +182,7 @@ def monitor_xml() -> str:
def main():
path = Path(__file__).resolve().parents[1] / "shows" / "xchc.qxw"
path = Path(__file__).resolve().parents[2] / "shows" / "xchc.qxw"
text = path.read_text()
for i, (name, rgb) in enumerate(COLORS.items()):
@@ -5,7 +5,7 @@ from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
OUT = ROOT / "shows" / "cabaret.qxw"
M1, M2 = 8, 9
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Write a Chataigne project from a show spec.
python3 scripts/make_chataigne.py shows/test.show.json chataigne/test
python3 scripts/shows/make_chataigne.py shows/test.show.json chataigne/test
Writes <out>/<name>.noisette and <out>/<name>.js. The script holds the scenes and
the pad and slider mapping, and sends DMX through the project's DMX module, named Lights, and a copy to Preview. Solo
@@ -16,7 +16,7 @@ import struct
import zlib
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
TEMPLATE = ROOT / "chataigne" / "show.template.js"
@@ -7,7 +7,7 @@ import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
@@ -33,7 +33,7 @@ def btn(
</Button>"""
ROOT = Path(__file__).resolve().parents[1]
ROOT = Path(__file__).resolve().parents[2]
def main():
+2 -2
View File
@@ -10,7 +10,7 @@ import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
sys.path.insert(0, str(ROOT / "scripts" / "shows"))
import make_chataigne # noqa: E402
@@ -35,7 +35,7 @@ class ChataigneExportTest(unittest.TestCase):
def test_writes_project_and_script(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
subprocess.run(
[sys.executable, str(ROOT / "scripts" / "make_chataigne.py"), str(ROOT / "shows" / "test.show.json"), tmp],
[sys.executable, str(ROOT / "scripts" / "shows" / "make_chataigne.py"), str(ROOT / "shows" / "test.show.json"), tmp],
check=True,
capture_output=True,
)
+1 -1
View File
@@ -7,7 +7,7 @@ import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
spec = importlib.util.spec_from_file_location("pad_colours", ROOT / "scripts" / "pad_colours.py")
spec = importlib.util.spec_from_file_location("pad_colours", ROOT / "scripts" / "pad" / "pad_colours.py")
colours = importlib.util.module_from_spec(spec)
assert spec.loader is not None
sys.modules["pad_colours"] = colours
+1 -1
View File
@@ -2,7 +2,7 @@ import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts" / "pad"))
from pad_layer import PlayLayer # noqa: E402
+1 -1
View File
@@ -155,7 +155,7 @@ def test_last_pad_keeps_its_short_tail():
def test_factory_image_reads_as_midisuite_shows_it():
# Captured from MidiSuite's Reset with scripts/decode_usbmon.py.
# Captured from MidiSuite's Reset with scripts/pad/decode_usbmon.py.
raw = (ROOT / "tests" / "data" / "smc_pad_factory.bin").read_bytes()
doc = unpack(raw)
assert pack(doc) == raw
+4 -4
View File
@@ -290,12 +290,12 @@ class ShowFileTest(unittest.TestCase):
target.unlink(missing_ok=True)
def test_animation_script_dry_run(self):
show = load_show(ROOT / "scripts" / "anim_eight.py")
show = load_show(ROOT / "scripts" / "anim" / "anim_eight.py")
frames = [show_frame(show, t) for t in (0, 2000)]
self.assertNotEqual(frames[0]["m1"][2], frames[1]["m1"][2])
self.assertEqual(frames[0]["m1"][8], 255)
completed = subprocess.run(
[sys.executable, "-m", "showfile", "run", "scripts/anim_eight.py", "--seconds", "0.1"],
[sys.executable, "-m", "showfile", "run", "scripts/anim/anim_eight.py", "--seconds", "0.1"],
cwd=ROOT,
check=False,
capture_output=True,
@@ -329,7 +329,7 @@ class ShowFileTest(unittest.TestCase):
def test_stage_map_drives_the_whole_rig(self):
stage = json.loads((ROOT / "stage" / "map.json").read_text(encoding="utf-8"))
show = load_show(ROOT / "scripts" / "anim_stage.py")
show = load_show(ROOT / "scripts" / "anim" / "anim_stage.py")
self.assertEqual([fx.key for fx in show.fixtures], list(stage["fixtures"]))
for key, raw in stage["fixtures"].items():
fixture = show.fixtures_by_key[key]
@@ -370,7 +370,7 @@ class ShowFileTest(unittest.TestCase):
outside = validate_show({"stage": "/etc/passwd"})
self.assertFalse(outside["ok"])
completed = subprocess.run(
[sys.executable, "-m", "showfile", "run", "scripts/anim_stage.py", "--seconds", "0.1"],
[sys.executable, "-m", "showfile", "run", "scripts/anim/anim_stage.py", "--seconds", "0.1"],
cwd=ROOT,
check=False,
capture_output=True,