18 KiB
Visualizer Controls Audit — Sidebar Parameters & Presets
Date: 2026-04-08
Scope: Full audit of the runtime animation loop for both MuonVisualizerCanvas.tsx and
FluidVisualizerCanvas.tsx. Documents every expression that changes during playback, identifies
which values are hardcoded and tunable, proposes new manifest keys and sidebar controls, and
defines named presets for each visualizer.
Part 1 — Muon: what changes during playback
Source: frontend/src/components/visualizers/MuonVisualizerCanvas.tsx
Input signals (per-frame)
| Signal | Source | Range | Description |
|---|---|---|---|
drum |
f.drumIntensity (clamped) |
0–1 | Primary reactive input. Weighted bass+rms+treble exponential scaler. |
treble |
f.treble (clamped) |
0–1 | High-frequency energy. Secondary hue influence. |
idle |
0.5 + 0.5 * sin(now * 0.0012) |
0–1 | Slow sinusoidal pulse (~5.2 s period) used when audio is quiet. |
beatDetected |
f.beatDetected |
bool | Triggers preset advance when true and >200 ms since last advance. |
Computed values (all hardcoded coefficients)
Radius system
RADIUS_PRESETS = [0.90, 0.95, 1.00, 1.05, 1.10, 0.85, 1.15, 1.02] (8 steps)
radiusTarget = RADIUS_PRESETS[presetIdx] + drum * 0.25 (on beat)
radiusCurrent += (radiusTarget - radiusCurrent) * 0.07 (lerp speed)
radiusMultiplier = (radiusCurrent + idle * 0.12) * radiusScale (with idle sway)
r = ring * radiusMultiplier * (1 + sin(angle * aperture) * 0.16) (sinusoidal variance)
Key hardcoded coefficients: lerp speed 0.07, idle sway 0.12, sinusoidal variance 0.16, drum
beat bonus 0.25, beat cooldown 200 ms.
Hue system
playing : hue = (seedHue + drum * 20 + treble * 15) % 360
silent : hue = (seedHue + sin(now * 0.00018) * 15) % 360
Drum pushes hue up to ±20°, treble up to ±15° from the seed colour.
Aperture (ellipse opening)
aperture = (1.55 + drum * 1.9 + idle * 0.24) * apertureScale
Range at apertureScale=1: 1.55 (silent+idle low) → 3.69 (loud drum+idle high). Controls how
elliptical the particle orbit becomes. The y-axis projection is always r * 0.62 (hardcoded
ellipse squash ratio).
Spacing (ring gap)
spacing = (0.015 + (1 - drum) * 0.014) * spacingScale
ring = base + lane * (spacing * min(w,h) * 5)
Quiet = wider rings (0.029), loud drum = tighter rings (0.015). Range factor 5 and base min(w,h)*0.2 are hardcoded.
Particle size
size = 1.75 + drum * 3.0 + (i % 4) * 0.35
Base 1.75 px, grows to 4.75 px at full drum. The (i % 4) * 0.35 creates four size tiers
(variety), hardcoded.
Alpha (opacity per particle)
alpha = 0.34 + drum * 0.42
Range: 0.34 (quiet) → 0.76 (loud drum). Composited with globalCompositeOperation = 'lighter'
(additive blending).
Glow
glow = 14 + drum * 28 (shadowBlur, px)
Range: 14 px (quiet) → 42 px (loud drum).
Rotation speed (per-frame angle advance)
pt.angle += pt.speed + drum * 0.02
pt.speed = 0.002 + (i % 9) * 0.00045 (per-particle, set on init)
Base speed range: 0.002–0.006 rad/frame. Drum adds up to 0.02 rad/frame on top.
Part 2 — Fluid: what changes during playback
Source: frontend/src/components/visualizers/FluidVisualizerCanvas.tsx
Input signals (per-frame)
| Signal | Source | Range | Description |
|---|---|---|---|
bass |
f.bass (clamped) |
0–1 | Low-frequency energy (bins 0–9 of FFT). Primary trail and beat driver. |
rms |
f.rms (clamped) |
0–1 | Overall loudness. Drives ambient spawn rate and drag. |
treble |
f.treble (clamped) |
0–1 | High-frequency energy. Drives blob pulse scale. |
beatDetected |
f.beatDetected |
bool | Triggers burst spawn. |
idle |
0.5 + 0.5 * sin(now * 0.0011) |
0–1 | Slow baseline (~5.7 s period). Added to ambient spawn strength. |
Computed values (all hardcoded coefficients)
Ambient spawn
spawnChance = (0.04 + rms * 0.31) * densityScale (per-frame probability)
spawnStrength = 0.22 + rms * 0.58 + idle * 0.08
At densityScale=1, rms=0: 4% chance/frame. At rms=1: 35% chance/frame.
Spawn strength range: 0.22 (quiet) → 0.88 (rms=1).
Beat burst
count = 3 + floor(bass * 4) (3–7 blobs per beat)
strength = 0.6 + bass * 0.8 (0.6–1.4)
Beat burst is the primary visual impact. Count and strength both scale with bass.
Blob properties (on spawn)
speed = (0.2 + strength * 2.2) * forceScale (px/frame)
radius = (8 + strength * 38) * sqrt(forceScale) (px)
life = 0.7 + strength * 0.6 (lifetime units, before decay)
Strong bass beat → speed ~3.3 * forceScale, radius ~61 * sqrt(forceScale).
Background fill (trail fade speed)
ctx.globalAlpha = 0.20 + (1 - bass) * 0.16
This is drawn over the canvas every frame to fade out old blobs. Range:
bass=0(quiet): alpha 0.36 → fast trail fadebass=1(loud): alpha 0.20 → slow trail fade (persistent ink on loud beats)
This is the primary visual trail control and is currently entirely implicit — not exposed via any setting.
Decay and drag
decay = (0.009 + (1 - bass) * 0.012) * decayScale
drag = 0.984 - rms * 0.010
b.life -= decay
b.dx *= drag
decay is subtracted from blob life each frame. At decayScale=1:
- Loud bass → 0.009/frame (long trail: ~77–110 frames to die)
- Quiet → 0.021/frame (short trail: ~33–47 frames to die)
drag retains dx/dy velocity. At rms=0: 98.4% retained; at rms=1: 97.4% retained. Small but
accumulates across many frames.
Treble pulse
pulse = 1 + treble * 0.25
r_render = b.radius * pulse * max(0.15, b.life)
Blobs swell up to 25% larger on treble hits. The max(0.15, b.life) also causes near-dead blobs
to be clamped to 15% of their base radius rather than vanishing immediately.
Colour cycling
Sequential through speakerPalette (from VisualizerPalette). No randomisation; no RMS/bass
influence on colour selection.
Part 3 — Proposed new parameters
3a — Muon new parameters
All values are multipliers (1.0 = current default behaviour) or direct overrides where noted.
| Key | Type | Default | Range | Step | What it controls |
|---|---|---|---|---|---|
particle_count |
int | 220 | 40–500 | 10 | Number of particles. Directly impacts density and GPU cost. |
rotation_speed |
float | 1.0 | 0.2–4.0 | 0.1 | Multiplies pt.speed base (0.002–0.006 rad/frame) and the drum rotation bonus (0.02). |
glow_intensity |
float | 1.0 | 0.0–3.0 | 0.1 | Multiplies glow = 14 + drum * 28. At 0.0 glow is disabled. |
particle_size |
float | 1.0 | 0.25–3.0 | 0.05 | Multiplies size = 1.75 + drum * 3.0. |
drum_reactivity |
float | 1.0 | 0.0–2.0 | 0.1 | Scales the drum signal before it is applied to aperture, spacing, hue, size, and alpha. Does not affect the beat-detection threshold. |
hue_range |
float | 1.0 | 0.0–3.0 | 0.1 | Multiplies the drum * 20 and treble * 15 hue drift coefficients. At 0.0 hue is locked to seed colour. |
beat_sensitivity |
float | 1.0 | 0.2–3.0 | 0.1 | Divides the beat-preset cooldown (200 ms). Higher = preset cycles faster per beat. At 2.0, minimum 100 ms between presets. |
ellipse_ratio |
float | 0.62 | 0.3–1.0 | 0.02 | Direct override of the y-axis squash factor. 1.0 = circular orbit; 0.3 = very flat ellipse. |
Implementation note: drum_reactivity should be applied as:
const drum = clamp01(f.drumIntensity * (settings?.drum_reactivity ?? 1))
This single multiplier propagates through aperture, spacing, size, alpha, glow, and hue without needing separate coefficients per expression.
Implementation note: particle_count requires reinitialising the particles array. It should
only be acted on inside the useEffect setup (as a dep), not inside the render loop.
3b — Fluid new parameters
| Key | Type | Default | Range | Step | What it controls |
|---|---|---|---|---|---|
background_persistence |
float | 1.0 | 0.2–3.0 | 0.1 | Multiplies (1 - bass) * 0.16 background-fill alpha contribution. Higher = slower trail fade = longer ink persistence on quiet passages. |
beat_burst_count |
float | 1.0 | 0.25–3.0 | 0.05 | Multiplies 3 + floor(bass * 4) blob count per beat. |
treble_pulse |
float | 1.0 | 0.0–3.0 | 0.1 | Multiplies the treble * 0.25 blob swell factor. At 0.0 blobs do not pulse on treble. |
drag |
float | 1.0 | 0.5–2.0 | 0.05 | Multiplies the velocity retention factor 0.984 - rms * 0.010. Higher = blobs slow down faster (more viscous). |
blob_life |
float | 1.0 | 0.25–3.0 | 0.05 | Multiplies initial blob life 0.7 + strength * 0.6. More life = blobs survive more decay ticks. |
Implementation note: background_persistence modifies the background fill expression as:
const bgAlpha = 0.20 + (1 - bass) * 0.16 * (settings?.background_persistence ?? 1)
ctx.globalAlpha = Math.min(1, bgAlpha)
Implementation note: drag modifies the drag expression as:
const drag = (0.984 - rms * 0.010) / Math.max(0.1, settings?.drag ?? 1)
(dividing by drag > 1 makes blobs retain less velocity = more viscous/heavier)
Part 4 — Named presets
Presets are stored client-side only (not in manifest.json). The sidebar "Visualizer" section shows
a preset row above the sliders; selecting a preset calls patchVizSettings(presetValues) for the
active visualizer's keys only, leaving the other visualizer's values untouched.
A Custom pseudo-preset is shown whenever any slider deviates from the active preset's values. Selecting a named preset restores its exact values. The Reset button behaviour is unchanged (resets to manifest.json values or VIZ_DEFAULTS, which may or may not match any named preset).
Muon presets
| Preset | particle_count |
rotation_speed |
glow_intensity |
particle_size |
drum_reactivity |
hue_range |
beat_sensitivity |
ellipse_ratio |
|---|---|---|---|---|---|---|---|---|
| Default | 220 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 0.62 |
| Calm | 120 | 0.5 | 0.4 | 0.7 | 0.5 | 0.4 | 0.5 | 0.55 |
| Energetic | 350 | 2.0 | 2.0 | 1.4 | 1.8 | 1.8 | 2.0 | 0.68 |
| Dreamy | 280 | 0.6 | 2.5 | 1.1 | 0.6 | 2.5 | 0.4 | 0.45 |
| Minimal | 60 | 0.8 | 0.0 | 0.6 | 1.2 | 0.0 | 1.0 | 1.0 |
| Cosmic | 400 | 1.5 | 1.8 | 1.8 | 1.4 | 2.0 | 1.5 | 0.38 |
Calm — sparse slow-moving particles with minimal glow and low audio reactivity. Good for background ambience during quiet songs.
Energetic — dense fast-spinning particles with strong glow and full audio reactivity. Best for high-BPM or hip-hop.
Dreamy — many particles with very high glow and wide hue drift but slow rotation. Works well for ballads and ambient music.
Minimal — few particles, no glow, locked hue. Almost geometric — the spiral structure is clearly visible without particle bloom.
Cosmic — maximum particles, strong glow, very flat ellipse. Fills the screen with a wide flat galaxy-like disc.
Fluid presets
| Preset | spawn_density |
splat_force |
decay |
background_persistence |
beat_burst_count |
treble_pulse |
drag |
blob_life |
|---|---|---|---|---|---|---|---|---|
| Default | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
| Ink | 0.6 | 1.8 | 0.4 | 2.5 | 2.0 | 0.5 | 1.5 | 2.0 |
| Foam | 3.0 | 0.5 | 2.5 | 0.4 | 2.5 | 2.0 | 0.6 | 0.5 |
| Lava | 0.3 | 2.5 | 0.3 | 3.0 | 0.6 | 0.3 | 2.0 | 2.5 |
| Mist | 1.5 | 0.4 | 1.5 | 1.0 | 0.7 | 1.5 | 0.8 | 0.8 |
| Storm | 2.5 | 2.0 | 0.8 | 0.6 | 3.0 | 2.5 | 0.5 | 1.2 |
Ink — few large slow-moving blobs with very long trails. Dense, dark-ink-on-canvas look.
Foam — many tiny short-lived blobs, fast decay, strong treble pulse. Frothy/bubbly texture.
Lava — few massive blobs with very slow decay and high viscosity. Large glowing pools that linger. Good for slow, heavy music.
Mist — light ambient density, low force, medium decay. Soft diffuse glow with gentle treble shimmer.
Storm — high density, high force, many beat blobs, strong treble. Chaotic burst-heavy response for energetic tracks.
Part 5 — Updated manifest.json schema additions
The new parameters extend the existing manifest.visualizer.settings.muon and
manifest.visualizer.settings.fluid sub-objects. All new keys default to 1.0 (or the explicit
default noted above) and are optional — absence means "use default".
{
"visualizer": {
"mode": "muon",
"settings": {
"quality": "balanced",
"fps_cap": 60,
"muon": {
"radius_multiplier": 1.0,
"aperture": 1.0,
"spacing": 1.0,
"particle_count": 220,
"rotation_speed": 1.0,
"glow_intensity": 1.0,
"particle_size": 1.0,
"drum_reactivity": 1.0,
"hue_range": 1.0,
"beat_sensitivity": 1.0,
"ellipse_ratio": 0.62
},
"fluid": {
"spawn_density": 1.0,
"splat_force": 1.0,
"decay": 1.0,
"background_persistence": 1.0,
"beat_burst_count": 1.0,
"treble_pulse": 1.0,
"drag": 1.0,
"blob_life": 1.0
}
}
}
}
Updated parameter summary
Muon (11 keys total: 3 existing + 8 new):
| Key | New? | Sidebar widget | Range |
|---|---|---|---|
radius_multiplier |
existing | Slider | 0.25–2.0 |
aperture |
existing | Slider | 0.25–2.0 |
spacing |
existing | Slider | 0.25–2.0 |
particle_count |
new | Slider (int) | 40–500 |
rotation_speed |
new | Slider | 0.2–4.0 |
glow_intensity |
new | Slider | 0.0–3.0 |
particle_size |
new | Slider | 0.25–3.0 |
drum_reactivity |
new | Slider | 0.0–2.0 |
hue_range |
new | Slider | 0.0–3.0 |
beat_sensitivity |
new | Slider | 0.2–3.0 |
ellipse_ratio |
new | Slider | 0.30–1.0 |
Fluid (8 keys total: 3 existing + 5 new):
| Key | New? | Sidebar widget | Range |
|---|---|---|---|
spawn_density |
existing | Slider | 0.25–2.0 |
splat_force |
existing | Slider | 0.25–2.0 |
decay |
existing | Slider | 0.25–2.0 |
background_persistence |
new | Slider | 0.2–3.0 |
beat_burst_count |
new | Slider | 0.25–3.0 |
treble_pulse |
new | Slider | 0.0–3.0 |
drag |
new | Slider | 0.5–2.0 |
blob_life |
new | Slider | 0.25–3.0 |
Part 6 — Sidebar layout update (Section 4 revision)
The PerformanceSidebar Section 4 layout should be updated to:
├──────────────────────────────────────────┤
│ ▾ VISUALIZER (hidden for Static/Video) │
│ [Calm] [Default] [Energetic] [Dreamy] │ ← preset pills
│ [Minimal] [Cosmic] [Custom] │
│ Quality [Low] [Balanced] [High] │
│ FPS cap [30] [60] │
│ ─────────────────────────────────────── │
│ Particle count ███░░░░░ 220 │
│ Rotation speed ████░░░░ 1.00× │
│ Glow ████░░░░ 1.00× │
│ Particle size ████░░░░ 1.00× │
│ Drum reactivity ████░░░░ 1.00× │
│ Hue range ████░░░░ 1.00× │
│ Beat sensitivity████░░░░ 1.00× │
│ Ellipse ratio ████████ 0.62 │
│ Radius ████░░░░ 1.00× │
│ Aperture ████░░░░ 1.00× │
│ Spacing ████░░░░ 1.00× │
│ [Reset to song defaults] │
└──────────────────────────────────────────┘
(Fluid variant swaps the parameter rows for its 8 keys; preset pills change to Ink/Foam/Lava/Mist/Storm/Default.)
Presets are stored as a local constant in PerformanceSidebar.tsx — not in manifest.json and not
in localStorage. They are not user-editable; users adjust sliders individually.
Part 7 — Implementation impact on existing files
MuonVisualizerCanvas.tsx
- Expand
settingsinterface with the 8 new keys. - Apply
drum_reactivitymultiplier to thedrumlocal variable at the top ofrender(). - Apply
rotation_speedtopt.speedin particle init and todrum * 0.02rotation bonus. - Apply
glow_intensitytoglow = 14 + drum * 28. - Apply
particle_sizetosize = 1.75 + drum * 3.0. - Apply
hue_rangeto thedrum * 20andtreble * 15hue coefficients. - Apply
beat_sensitivityby dividing the 200 ms cooldown:200 / beatSensitivity. - Use
ellipse_ratioin place of the hardcoded0.62. particle_count: reinitialiseparticlesinsideuseEffectwhen the dep changes (addsettings?.particle_countto the dep array or detect the change and reinit).
FluidVisualizerCanvas.tsx
- Expand
settingsinterface with the 5 new keys. - Apply
background_persistenceto the background fill alpha expression. - Apply
beat_burst_counttocount = 3 + floor(bass * 4). - Apply
treble_pulsetopulse = 1 + treble * 0.25. - Apply
dragmultiplier to the drag expression. - Apply
blob_lifemultiplier tolife = 0.7 + strength * 0.6inspawnBlob.
VisualizerBackdrop.tsx
No change needed — already passes settings?.muon and settings?.fluid to the respective
canvases. New keys are transparent as long as the canvas interfaces are expanded.
PerformanceSidebar.tsx
- Add preset constant arrays for Muon and Fluid.
- Add preset pill row above Quality/FPS controls.
- Add 8 Muon sliders and 5 Fluid sliders (in addition to existing 3+3).
- Detect deviation from active preset → show "Custom" as active.
LyricsLivePreview.tsx / VizSettings type
Expand VizSettings and VIZ_DEFAULTS with the 13 new keys across both sub-objects.
Backend — _normalize_visualizer_config (optional)
The backend currently writes only radius_multiplier, aperture, spacing, spawn_density,
splat_force, decay to manifest.json. If per-song presets are ever authored at export time,
the backend normaliser will need to accept and round-trip the new keys. For the sidebar use-case
(live adjustment only), backend changes are not required.