v0.77.0: the laser visualizer is the Oscilloscope — screen sliders and rig diagram gone, a graticule dot size, and a sync delay per style

This commit is contained in:
2026-10-23 00:21:32 -07:00
parent 5413263587
commit 5f41460cb6
13 changed files with 357 additions and 478 deletions
+21 -13
View File
@@ -268,21 +268,28 @@ persistence) → GUI (Qt widgets that read the manager and connect to its signal
drew as a flat arc. "Even out bass and treble" removes a *straight*,
loudness-weighted dB-vs-log-f tilt, clipped to ±24 dB, and never lifts a
band that isn't sounding (a curve fitted to a lone tone lit up silent
treble). **Laser** simulates a mirror on a speaker membrane: the
treble). **Oscilloscope** (`laser` in code and prefs — Round 108 renamed
only what the user sees) is an **X-Y scope of the bass**: nine resonators
(≈50–160 Hz) each push the trace along a fixed direction, and the sum is
X and Y. *Where* they sit and *which way* they push comes from modelling a
laser off a mirror on a speaker membrane (Tame Impala's rig): the
circular-membrane modes run as complex one-pole resonators, vectorized in
`CHUNK`s. Loops come from the split degenerate pairs, between whose
resonances x and y answer up to 90° apart, hence the slack 50 Hz membrane
with a wide split. The beam ray is intersected with a screen at
`distance`, turned by pitch/yaw/roll; the auto-gain holds the beam
*angle*, so distance is real, and `scale()` shrinks the drawing only when a
steep screen would push the loudest swing out of view. The path is drawn
with a wide split. Round 78's screen distance/pitch/yaw/roll sliders and
the live rig diagram are gone (Round 108): they only resized, stretched or
spun the same tangle, so trav found they "don't really do anything". The
screen is fixed square at `SCREEN_DISTANCE`; a still `gui/scope_drawing.py`
sits beside the look controls. The graticule's dots have a size
(`visualizer_laser_grid_dot`, × the automatic size). The path is drawn
brighter where it moves slower (dwell). The afterimage is a **phosphor**
(`_Phosphor`, one per painted size, half resolution past 400 px wide):
each sweep is burned in once and the buffer is dimmed per frame, so cost
doesn't grow with the fade time. The dimming is a numpy LUT that rounds
*down*, because Qt's own fade rounds to nearest and stalls faint pixels
forever. The numpy array must be a **view of the QImage's `bits()`**, since
building a QImage *from* an array copies it. A **speaker range** (low/high
building a QImage *from* an array copies it. A **frequency range** (the
"speaker" in code, low/high
Hz, `gui/range_slider.py`) filters what drives the membrane, with
`one_pole` stages done exactly via the cumsum trick, 36 dB/octave. That is
steeper than a real speaker on purpose: the membrane answers bass ~80 dB
@@ -297,10 +304,14 @@ persistence) → GUI (Qt widgets that read the manager and connect to its signal
buffers arrive in a burst. So the widget keeps 1.5 s of *timestamped*
history (`QAudioBuffer.startTime()`) and each frame draws the stretch
ending at `Player.position_ms()`, carried forward by the clock between
Qt's buffer-sized steps, minus `visualizer_sync_delay_ms`. That delay is
output latency Qt can't see (Bluetooth), this machine's hardware, so it
lives in **`config.json`**; the dialog emits `prefs.changed` after writing
it so the widget re-reads. The laser takes every heard sample exactly once
Qt's buffer-sized steps, minus the sync delay. That delay is output
latency Qt can't see (Bluetooth), this machine's hardware, so it lives in
**`config.json`** — and since Round 108 **one per style**
(`visualizer_sync_delays: {style: ms}`, the slider right under each page's
preset), because each style adds its own lag (radial's FFT window, the
bars' fall, Kaleidostrobe's 25 fps, the scope's ringing). A style not yet
set starts from the old shared `visualizer_sync_delay_ms`. The dialog emits
`prefs.changed` after writing it so the widget re-reads. The laser takes every heard sample exactly once
(`_drawn` index), never the newest-decoded ones.
**Presets** (`gui/visualizer_presets.py`): per style, `STYLE_KEYS` under a
name, in `visualizer_presets` (synced; never the sync delay). `Default` is
@@ -310,9 +321,6 @@ persistence) → GUI (Qt widgets that read the manager and connect to its signal
"Custom" whenever the settings match no preset. A setting added later
must join `STYLE_KEYS` and register a setter, or presets silently skip it
(`test_every_style_key_has_a_control` pins that).
The laser page draws the rig (`gui/laser_diagram.py`, textbook line art
through the renderer's own `_rotation`); it labels distance, angles and
dot size, so those sliders show no number.
**Dark mode** (Round 101, Preferences › Appearance): `theme.mode(prefs)`
picks a whole palette (`_dark_palette`, every role) in dark, or the
base palette plus overrides in light. Each mode has its own gray sliders