Skip to content

perf(viz): snappier reactivity across braille visualisers#59

Merged
vxcozy merged 1 commit into
mainfrom
fix/viz-reactivity
Apr 18, 2026
Merged

perf(viz): snappier reactivity across braille visualisers#59
vxcozy merged 1 commit into
mainfrom
fix/viz-reactivity

Conversation

@vxcozy
Copy link
Copy Markdown
Owner

@vxcozy vxcozy commented Apr 18, 2026

Summary

  • Retune SpectrumScaler AGC (attack 50ms → 25ms, release 2.5s → 1.2s) so the bar family snaps to transients and tracks song sections instead of averaging five seconds of audio into the ceiling.
  • Tighten the shared EnergyTracker release coefficient 0.88 → 0.75 (tau 258ms → 115ms) on 16 viz whose energy drives amplitude, brightness, or spawn rate.
  • Pull bars_outline per-bar release into line with bars_dot (0.85 → 0.80) so outline bars decay like their filled cousins.

Why

Users reported the entire visualiser suite feels sluggish, not just the bar family. Two compounding sources:

  1. PR fix(viz): log/dB scaling for bar visualisers #57's AGC was tuned for safety. A 2.5s release ceiling averages loudness over a whole song section; during that window bars lag behind the current dynamics. Tightening to 1.2s lets the ceiling track choruses/verses without strobing on brief dips. Attack also dropped to 25ms so a kick drum is reflected the same frame it arrives.

  2. EnergyTracker default pattern (0.5, 0.88, 500.0) is used by ~20 viz. The 0.88 retention on release means brightness and amplitude carry forward ~260ms of history — perceptually "moving on a delay". 0.75 retention halves that to ~115ms, which is still enough to hide FFT jitter but not enough to read as lag.

The attack side (0.5 retention, tau ~48ms) was already fine and left alone. Transient-detection viz (pulse, firework at 0.3/0.85) deliberately use a slow baseline so their energy-delta triggers work — left untouched. Texture viz (tunnel, vortex, plasma, metaballs, moire at ≥0.9 retention) drive smoothly-evolving shaders where "snappy" reads as jitter — left untouched.

Per-viz changes

Viz Parameter Before → After Rationale
scaling.rs SpectrumScaler ATTACK 0.48 → 0.735 50ms → 25ms tau; kick transients snap same-frame
scaling.rs SpectrumScaler RELEASE 0.013 → 0.027 2.5s → 1.2s tau; ceiling tracks song sections
bars_dot.rs EnergyTracker release 0.88 → 0.75 overlay brightness tracks the beat
bars_outline.rs EnergyTracker release 0.88 → 0.75 overlay brightness tracks the beat
bars_outline.rs per-bar release blend 0.85 → 0.80 match bars_dot; bars stop hanging above the music
classic_peak.rs EnergyTracker release 0.88 → 0.75 peak-cap accent tracks dynamics
heartbeat.rs EnergyTracker release 0.88 → 0.75 ECG amplitude follows beat envelope
wave.rs EnergyTracker release 0.88 → 0.75 trace brightness dims between transients
scope.rs EnergyTracker release 0.88 → 0.75 phosphor responds within ~100ms
matrix.rs EnergyTracker release 0.88 → 0.75 drop speed drops on phrase boundaries
terrain.rs EnergyTracker release 0.88 → 0.75 mountain heights track current loudness
retro.rs EnergyTracker release 0.88 → 0.75 sun radius pulses, not glides
rain.rs EnergyTracker release 0.88 → 0.75 spawn probability tracks the beat
binary.rs EnergyTracker release 0.88 → 0.75 bit field reshuffles with phrases
butterfly.rs EnergyTracker release 0.88 → 0.75 wings flap with the beat
scatter.rs EnergyTracker release 0.88 → 0.75 scatter density follows the beat
fire.rs EnergyTracker release 0.88 → 0.75 heat injection pulses with the music
sakura.rs EnergyTracker release 0.88 → 0.75 petal emission breathes with the beat
ripples.rs EnergyTracker release 0.88 → 0.75 drop-spawn gating reacts to current beat

Deliberately untouched: pulse, firework (transient detection needs slow baseline), tunnel, vortex, plasma, metaballs, moire (texture viz — jitter would read as noise, not snap).

Test plan

  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --all-features (all existing scaling:: + per-viz tests pass under new coefficients)
  • manual: play radio, cycle through braille viz, confirm each "moves with the music" instead of lagging a quarter second
  • manual: confirm pulse/firework transient triggers still fire on beat drops
  • manual: confirm texture viz (plasma, metaballs, moire) still look smooth, not jittery

Users report the entire visualiser suite feels sluggish — not just the
bar family. The shared sluggishness is the one-pole EnergyTracker used
by ~20 viz with release=0.88 (tau ~258ms at 30fps), plus the PR #57 AGC
whose 2.5s release was tuned for safety over feel. Tightening time
constants where the viz is meant to track the beat (not slowly evolve
textures) restores the "it's moving with the music" quality.

scaling.rs (SpectrumScaler AGC, bars family):
  attack:  0.48  -> 0.735 (tau 50ms -> 25ms; kick snaps same frame)
  release: 0.013 -> 0.027 (tau 2.5s -> 1.2s; ceiling tracks sections)

Per-viz EnergyTracker release retained 0.88 -> 0.75 (tau ~258ms -> 115ms):
  heartbeat, wave, scope, matrix, terrain, retro, rain, binary,
  butterfly, scatter, fire, sakura, ripples, bars_dot, bars_outline,
  classic_peak.

bars_outline per-bar release: 0.85 -> 0.8 (tau 203ms -> 148ms, matches
bars_dot).

Deliberately untouched:
  - pulse, firework (0.3, 0.85) — delta-based transient detection needs
    a smoother baseline; tightening release defeats the spike trigger.
  - tunnel, vortex, plasma, metaballs, moire (>=0.9 retention) — these
    drive smoothly-evolving textures where jitter would read as noise,
    not snappiness.

Existing scaling.rs unit tests (attack_faster_than_release,
typical_listening_peak_fills_majority_of_pane, etc.) all pass under
the new coefficients — the attack:release ratio is still ~27:1.

Closes clitunes-lc4 / CLI-91
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vxcozy vxcozy merged commit 683bc68 into main Apr 18, 2026
12 checks passed
@vxcozy vxcozy deleted the fix/viz-reactivity branch April 18, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant