Seoul
A MilkDrop-inspired real-time audio visualizer in Rust — desktop audio in via WASAPI loopback, FFT features out, rendered as feedback-driven shader visuals with hot-reloadable presets.
About
Seoul is a from-scratch music visualizer in the MilkDrop tradition: whatever your desktop is playing gets captured via WASAPI loopback, analyzed into bass/mid/treble bands, beat detection, and waveform data, and fed into feedback-driven shader visuals — the trails-and-warp aesthetic where each frame eats a distorted copy of the last one.
A preset is just a TOML + WGSL pair. The TOML declares four expressions — zoom, rotation, warp_amount, decay — in a tiny mini-language with the audio features as variables (bass, treble_att, beat, time…), evaluated every frame to drive the warp. The WGSL is a single fragment function drawn additively on top of the warped feedback. Presets hot-reload, and a bad shader returns an error instead of crashing the device, so you can live-edit visuals while the music plays.
Architecture
Three long-lived threads exchange data through lock-free structures:
- Audio callback (cpal/WASAPI) — downmixes to mono and pushes into a ring buffer
- Analysis thread — 2048-point Hann-windowed FFT, log-spaced spectrum, band energies, RMS, and history-ratio beat detection, snapshotted into a triple buffer
- Render thread — three passes over ping-pong HDR feedback textures: a CPU-displaced warp grid, the preset’s additive composite (with constant-blend crossfades between presets), and an aspect-corrected blit
The AudioFeatures struct is simultaneously the CPU-side snapshot and the exact GPU storage-buffer layout every preset shader binds — one definition, no marshalling.
Technical Details
- Language: Rust
- Rendering: wgpu, WGSL, fixed 1280×720 Rgba16Float feedback chain
- Audio: cpal with explicit WASAPI host (Windows loopback capture)
- Presets: TOML expression mapping + WGSL composite, hot-reloadable