The Drop · July 13, 2026

How beat detection actually works in a music visualizer

Load a track and the screen starts cutting, flashing and pulsing in time with the song. It feels like magic, but underneath it is a handful of small, understandable steps. Here is a plain look at how beat detection works: how a browser tool listens to raw audio, decides where the beats are, figures out the tempo, and even tells a kick drum apart from a hi-hat. No signal-processing degree required.

A neon audio waveform on a black background, the amplitude signal a music visualizer's beat detector reads to find each hit

Photo via Unsplash

The two jobs hiding inside "beat detection"

People say beat detection like it is one thing. In practice a good visualizer is doing two different jobs at once. The first is finding beats live, moment to moment, as the audio plays, so it can flash on the exact hit. The second is finding the tempo, the BPM, which is a single number for the whole song that sets the grid everything else snaps to. They use different math and they run at different times, so it helps to look at them one at a time.

How it hears a beat in real time

While the track plays, the browser's Web Audio API hands the app a fresh snapshot of the sound many times a second. The tool runs that audio through an analyser that splits it into frequency bins, then it measures the energy sitting in the low end, roughly the kick and bass range. That single energy number goes into a short rolling history, about the last two thirds of a second. On every frame it compares the current energy against the average of that recent history. When the current level jumps well above the running average, that spike is a beat, and the screen flashes.

The useful part is that the test is relative, not a fixed volume. A quiet acoustic track and a loud master each carry their own moving baseline, so a beat is anything that stands out from its own recent past rather than anything louder than some hard-coded number. That is why the same detector works on a whisper-quiet intro and a wall-of-sound drop without you touching a thing.

Why bass, and why the short pause between flashes

It listens to the low frequencies on purpose. In most music the kick and the bass are the clearest, most regular pulse, while vocals and cymbals are busier and noisier. Reading the low end gives the cleanest picture of the actual groove.

There is also a brief lockout after each detected beat, a fraction of a second where it will not fire again. Without it, one kick could register as three or four flashes, because the energy stays high for a few frames after the hit lands. That cooldown keeps one kick as one flash. If you have ever used a detector that strobes into a jittery mess on a single snare, a missing cooldown is usually why.

How it finds the tempo before the song even plays

Real-time detection is great at catching hits, but on its own it does not know the tempo. For that the app does a separate pass the moment you load the file, before anything is on screen. It reads the first stretch of the track and builds an energy envelope, a simplified outline of where the loud moments fall. Then it looks specifically at where the energy rises, since a rise usually means a new hit rather than a note ringing out.

To turn those rises into a BPM it uses autocorrelation, which is a heavy word for a simple idea: slide the pattern against a delayed copy of itself and see which delay lines the peaks up best. If beats land every half second, the pattern matches itself strongly at a half-second offset, and half a second between beats is 120 BPM. The app scans every tempo from 60 up to 180 and keeps the one that lines up cleanest.

One classic trap is the octave error, where a 140 BPM song reads as 70 because half speed also fits the pattern. The tool guards against it by nudging very slow reads back up when the double-time tempo scores nearly as well, which is why a fast genre reads correctly instead of landing at half tempo. The drum and bass guide leans on exactly that, because 174 BPM is the tempo most detectors trip over.

Telling a kick from a snare from a hi-hat

Beyond a plain beat, the app can fire different images on different drums, and that needs more than one energy number. It splits the spectrum into three bands, low for the kick, mid for the snare, high for the hi-hat, and watches each one separately.

Here the trick is measuring the rise in energy, not the level. A steady bassline holds the low band high the whole time, so a level-based check would decide the kick is always firing. By looking only at how much a band jumps compared to the instant before, a sustained note counts for almost nothing while a fresh hit spikes hard. That rise-based measure has a name, spectral flux, and it is what lets the trap visualizer fire a separate image on the kick, the snare and the hat without them bleeding into each other. When two drums land at the same time, the kick wins, then the snare, then the hat.

Why detection sometimes gets it wrong

No detector is perfect, because music is not built to be measured. A busy track with no clear kick, heavy sidechain pumping, or a genre that deliberately hides the downbeat can all confuse it. That is why the app gives you a sensitivity control instead of pretending it always guesses right. If the screen barely reacts, raise the sensitivity so smaller spikes count. If it flashes on everything, lower it so only the real hits get through. Tuning by ear beats any default, because you can watch the result against the song and adjust in a couple of seconds.

How the detected beat turns into visuals

Once the app knows the beats, the tempo and the drums, it has everything it needs to drive the picture. The live beat fires the flash. The BPM sets a grid, and you pick how often the content changes against it, from a lazy new look every four beats down to a frantic swap every eighth beat. Sustained heavy bass trips a separate bass drop mode that glitches and shakes the frame, the same engine the dubstep visualizer rides through a wobble section. Assigned drum hits swap in their images. You are not animating any of this by hand; the song is, and the detector is just the translator.

When it looks right you hit render and the visualizer captures a 1080p WebM with the audio muxed in, free and with no watermark, and nothing you loaded ever leaves your browser. WebM uploads straight to YouTube, or you convert it to mp4 with one line, ffmpeg -i in.webm -c:v libx264 -crf 18 out.mp4, if some other site asks for it.

One safety note, because this is strobe content

Fast full-screen flashing can trigger a seizure in someone with photosensitive epilepsy, and the widely used accessibility guidance is to keep flashing to no more than three flashes a second. If you are sharing a beat-synced video with an audience you cannot screen, turn the persistent flicker down or off and let the slower beat cuts carry the motion. A clean edit still hits hard, and you do not need a seizure risk to make it look loud.

See beat detection in action

Load a track and watch it flash, cut and glitch in time. Free, in the browser, 1080p WebM.

Open the visualizer