$ show jberg/butterchurn
butterchurn is a browser-based, real-time music visualizer that faithfully reimplements the classic MilkDrop visualizer using WebGL2. It consumes audio from the Web Audio API, runs FFT analysis to derive frequency/amplitude data, and drives a shader-based render pipeline from JSON presets that encode MilkDrop-style equations. The core library exposes a minimal `createVisualizer()` entry point, after which consumers load a preset and call `render()` with audio level data each animation frame. The library supports two equation execution paths: a JS-based expression runner and a WebAssembly/AssemblyScript-based EEL runner, with a custom Rollup plugin that compiles AssemblyScript to base64-encoded WASM at build time. It also includes deterministic seeded RNG for reproducible rendering, which is used by its visual regression test suite to compare JS and WASM paths pixel-for-pixel across a curated set of presets.
The LLM identified 4 files worth highlighting for reuse:
A self-contained seeded pseudo-random number generator that enables deterministic visual output, which is essential for regression testing and reproducible rendering. It can be extracted into any JavaScript project needing consistent RNG behavior without external dependencies.
Performs FFT-based frequency analysis on audio samples to produce the spectrum and waveform data used by the visualizer. This is an isolated DSP module that could be reused in other audio-reactive or spectral-analysis applications with minimal modification.
Provides utilities for parsing GLSL shader source and extracting custom samplers/uniforms, allowing user presets to inject shaders into the render pipeline. The parsing logic is generic and portable to other WebGL/WebGPU projects that need flexible shader configuration.
Generates deterministic procedural noise textures used as samplers in the visualizer's GLSL shaders. This is a standalone texture-generation helper that can be lifted into any graphics project needing repeatable noise maps without external texture assets.