InputMiddleweight
Audio input & FFT
Sound split into frequencies, live.
Sound from the microphone or a track, split into frequencies every frame: bass, mids, highs. Bars that dance, a sphere that pulses to the beat. Nothing plays until the person clicks.
- Breaks when
- needs a user gesture to startraw bins are noisy; smooth them
- Also called
- AnalyserNode, audio reactive, music visualizer, FFT
Prompts
Reactive scene, three bands
WebAudio AnalyserNode (fftSize 1024, smoothingTimeConstant 0.8) on a track loaded from a file input or a demo MP3. Compute three bands per frame from the bins: bass (20–140 Hz), mids (140–2 kHz), highs (2–8 kHz) as normalized energies, smoothed with attack 0.3 / release 0.08. Bass scales a central sphere, mids drive a ring’s displacement, highs add sparkle particles. Show the bins as a discreet bar row and a start button that resumes the AudioContext.
Beat that actually lands
Beat detection from the analyser: energy in the 60–150 Hz band compared with its 1 s running average (threshold 1.3×, refractory 250 ms), emitting a beat event; a visual pulse with a spring on each beat. Show the detected BPM over 8 s and explain why this fails on music without a kick.
Microphone with consent
Use getUserMedia audio into the analyser: a clear enable button, a level meter so people know it works, a mute toggle that stops the tracks (not just gain), and no recording. Fall back to a synthesized signal for demo mode when the mic is denied.
Related
Resources · 2
- three.js example: WebAudio visualizermrdoobsite · code · demoJun 12, 2026
- MDN: AnalyserNodemdnsite · codeMar 5, 2026