Anchoring to the Groove: Phase vs. Delta-Time
Anchoring to the Groove: Phase vs. Delta-Time
A common mistake in procedural visualizers is relying entirely on Euler integration for continuous movement (like a rotating camera or a spinning object).
The "Drift" Problem
When you want an object to spin based on the music's energy, the naive approach is to map audio energy to angular velocity :
The problem: Because (frame time) and (energy) are decoupled from the track's actual BPM, the rotation will eventually drift entirely out of phase with the track's groove. It becomes background noise.
The Solution: Predictive Phase-Locking
Modern audio engines calculate a predictive Inter-Onset Interval (IOI) and expose a beat_phase ()—a normalized sawtooth wave that ramps from to exactly between predicted beats.
Instead of integrating velocity over time, we define positions as a function of this phase.
Now, we can lock visual events mathematically to the groove:
A. The Rhythmic Snap: Trigger a camera tilt only when the phase rolls over.
B. The Anticipation Easing: Drive continuous parameters using shaped easing functions on , so the visualizer "winds up" before the beat drops.
By anchoring to instead of , the visuals are mathematically guaranteed to lock to the grid of the music, perfectly syncing with syncopations and swing.