Skip to content

feat(audio): analysis pass and audio-reactive components#59

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/audio-reactive
Jul 19, 2026
Merged

feat(audio): analysis pass and audio-reactive components#59
LeadcodeDev merged 1 commit into
mainfrom
feat/audio-reactive

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #47 — the music-visualization family.

  • Analysis pass: per-video-frame RMS amplitude + 16 log-spaced bands (20Hz–16kHz), normalized 0..1 globally per track (per-band normalization was the sub-agent's first attempt — it destroys inter-band comparability and the hardened 440Hz test caught it). Computed with Symphonia + rustfft (Hann 2048; pure-Rust dep on the rustmotion crate only), cached in core via the established video_frame_cache pattern, filled at the same call sites as preextract_video_frames (both encode paths, incremental, studio preview).
  • audio_spectrum (bars/radial, resampled bar count, bottom-anchored / center-radial) and waveform (line/filled, sliding window centered on now; field named draw_stylestyle is the universal CssStyle field). Missing analysis degrades gracefully (min-height bars / flat line), never panics.
  • Generic audio-reactive style binding: {track, source: "amplitude"|{"band": n}, property: opacity|scale|translate_y|rotation, min, max, smoothing_frames} — lerped and composed after animations in build_child; deterministic min with an empty cache.
  • Skill rule documents components, binding and the band table.

Tests: 6 new — a hand-written WAV fixture (440Hz sine + silence) through the production load path asserting amplitude envelope and 3× band dominance; synthetic-cache pixel tests for spectrum/waveform/binding (hermetic, unique keys per test); corpus entries enforced by the completeness test. 296 total, all green.

Verify: cargo test --workspace → 296 passed ✓ · cargo fmt --check ✓ · clippy 0 warnings (--all-targets) ✓

- AudioAnalysis (per-video-frame RMS amplitude + 16 log-spaced bands
  20Hz-16kHz, 0..1 normalized globally per track) cached in core via
  the video_frame_cache pattern; computed in rustmotion (Symphonia
  decode, Hann-2048 rustfft) at the same call sites as
  preextract_video_frames (both encode paths, incremental, studio)
- new audio_spectrum component (bars/radial, resampled bar count,
  graceful min_height degradation) and waveform (line/filled, sliding
  window; draw_style field name since style is the universal CssStyle
  field)
- generic audio-reactive style binding: amplitude or band source
  mapped onto opacity/scale/translate_y/rotation with lerp(min,max)
  and optional moving-average smoothing; deterministic min when no
  analysis is cached
- audio-reactive skill rule; rustfft added to the rustmotion crate
  only (pure Rust)
@LeadcodeDev
LeadcodeDev merged commit 70741a1 into main Jul 19, 2026
@LeadcodeDev
LeadcodeDev deleted the feat/audio-reactive branch July 19, 2026 00:07
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.

feat(audio): analysis pass and audio-reactive components

1 participant