where's the beat?

3. beat tracking

Contents

Set a metronome to 120 BPM and start it halfway between two kicks in a 120 BPM house track. It can click between kicks for the entire song. The tempo is right. The starting position, or beat phase, is a quarter second late. A beat grid marks the times where the beats are expected. For a steady track, beat number nn, counting from zero, falls at tn=ϕ+nTt_n=\phi+nT. Here TT is the beat spacing, and ϕ\phi is the time of the first grid mark. [5, 11]

One way to fit the grid is to slide it through one beat period and see where its marks coincide with the strongest onsets. Vande Veire and De Bie tested a fixed-tempo tracker on 220 drum-and-bass tracks. On four, it found the correct tempo and put the beats halfway between their intended positions. Try “½ beat late” under Grid phase in Figure 1 to see the same error. [11]

4/4
Amplitude envelope of bars 1 and 2 of the synthesized loop
BeatDownbeatPhrase start
8-bar loopBar 01 · Beat 1

Grid aligned to the beat.

Figure 1. Shifting the grid by half a beat preserves the tempo and moves each marker between kicks.

Following a moving beat

A live tracker can predict the next kick from the last few, then nudge its clock when a kick arrives early or late. This is the idea behind a phase-locked loop. Small nudges keep one early snare from pulling the whole grid sideways. They also make the tracker slower to follow a real tempo change. BeatRoot keeps several possible grids running at once. A pattern that seemed weak two beats ago can win as more hits come in. On recordings without drums, Goto and Muraoka also listen for changes of chord, when a new group of notes sounds together. [7, 12, 13]

Using the whole recording

Suppose a loud clap lands just before an expected beat, followed by four kicks exactly on the original grid. Those later kicks help settle where the earlier beat belonged. Ellis’s dynamic programming method scores possible sequences. It rewards beats near strong onsets and penalizes gaps far from the expected period. A gap twice as long as expected carries the same penalty as one half as long. For each candidate it remembers the best path leading there, then traces back through those choices. The Python library librosa implements this approach and can take a changing tempo as input. [3, 14]

With a live feed, the four later kicks have yet to arrive. BTrack predicts beats as audio comes in. The real-time predominant local pulse method estimates the pulse that best fits the recent audio and projects it forward. The aubio library reports beat times and a confidence estimate a piece at a time. These trackers can keep a light pulsing through a missing kick. If the track actually stops there, that same prediction can give you one flash too many. [15, 16, 17]