where's the beat?
a survey of existing computational methods for detection of beat, bar, and phrase in music, focused primarily (but not exclusively) on 4/4 electronic dance music
abstract
If you’ve ever been to a club, festival, or EDM show, you know the feeling of anticipation just before the beat drops. Even if you don’t dance, you can probably tap out the beat of most songs without thinking about it. I figured it wouldn’t be too hard to recreate that skill in code. I was mistaken. In pursuit of the Optimal Algorithm for a live audiovisualizer I’m developing, I decided to survey existing methods for detection of beats, bars, and phrases in music, primarily in 4/4 electronic dance music and its many subgenres.
Assume a standard "house" music style track (4 beats to each measure). Beat tracking means detecting each individual beat. Downbeat tracking means figuring out which beat in any group of four is the "first" one. Phrase detection means figuring out which measure in any group of four (a length of sixteen beats overall) is the "first" measure.
In this survey I compare the complexity and practical usefulness of computational methods & algorithms for detection of the above signals, ranging from simple rules and signal-processing algorithms to probabilistic trackers via simple neural networks, with a few tangential (yet fascinating) errata along the way.
Contents
1. onset detection
Definitions
Count “one and two and three and four and” over a house track. Tap your foot on the numbers. Those taps mark the beats. Imagine a kick on each number and a hi-hat on each “and.” The instant the hat starts is its onset. It falls between two beats. Mute the kick on three and leave that count silent. There’s a rest in the music, and your foot still taps three. An onset detector marks where sounds start. Many beat trackers fit a pulse to those marks, or to a score of how strong each possible onset is. [1, 2, 3]
Finding a kick in the waveform
A digital recording stores samples, measurements of a sound wave’s amplitude at successive instants. Plot them against time and you have a waveform. Even a loud kick has positive and negative values that can average to nearly zero. Squaring the samples before adding them keeps both halves of the wave from canceling out and gives a measure of its energy. [1]
Look at a short stretch of samples at a time. This is the analysis window, and the samples in it form one frame. A short window lets the detector distinguish the kick from the quiet just before it. A common measure of level is root-mean-square (RMS) amplitude. Average the squared samples, then take the square root to return to the original amplitude scale. When this level jumps relative to recent frames, the detector records the time. Briefly ignoring further jumps keeps one kick from triggering twice. Measuring only low frequencies can help isolate the kick. [1]
Hearing the hi-hat over the bass
A quiet hi-hat over a sustained bass note may barely change the total level. What gets stronger are the high frequencies, the faster vibrations in the sound wave. A fast Fourier transform (FFT) measures how much of each frequency is present in a window. The result is a spectrum divided into narrow frequency ranges called bins. Repeating the calculation on overlapping windows gives a short-time Fourier transform (STFT). Draw the strengths over time and you get a spectrogram. [1]
Spectral flux measures change by adding up increases in strength across the bins from one frame to the next. The new hi-hat raises that score. So can vibrato, a slight wavering in the pitch of a held note, as the sound moves into a neighboring bin. Böck and Widmer’s SuperFlux algorithm checks whether nearby bins were already strong. That makes it less likely to mistake one wavering note for several new ones. [1, 4]
A complex-domain detector also uses each frequency component’s phase, its position in its own wave cycle. It predicts how the existing tones will continue, then measures how far the next frame differs. A new note can disrupt that prediction even when the total level changes little. [1]
When the app can report it
RMS and spectral flux are features, measurements made from the audio. At 48,000 samples per second, a window of 1,024 samples covers 21.3 milliseconds (ms). If the window is labeled at its midpoint, its last sample arrives 10.7 ms after that label. The hop is the step to the next window. A 256-sample hop takes 5.3 ms. Waiting one more frame to confirm a peak brings the delay to about 16 ms. That’s latency, the gap between the time you mark and the time you can report it. A file can store the earlier timestamp. A flash triggered by this detector has to wait. [1]
2. tempo estimation
A kick every half second gives two kicks per second, or 120 beats per minute (BPM). Its period is the time from one beat to the next. Divide 60 by the period in seconds to get BPM. Now add hi-hats halfway between the kicks. The hats and kicks together mark 240 events per minute, and a listener tapping every other kick marks 60. The recording supports all three rates. A tempo estimator has to choose which pulse to follow. [5, 6]
Measuring the gaps
A tap-tempo button measures the gaps between your taps. Taking the middle gap after sorting them, the median, keeps one late tap from dominating. Software can do something similar with the onsets from section 1. The BeatRoot tracker also measures gaps between hits that have other hits in between. In the kick-and-hat pattern, consecutive hits are a quarter second apart, but many pairs are half a second apart. BeatRoot groups similar gaps and collects support for periods related by simple multiples. [7]
Looking for repetition
Keep a running score of how strongly a new sound seems to start in each window. This series is the onset envelope. Slide a copy of it half a second to the right. If the kicks repeat every half second, their peaks line up again. Trying many shifts and measuring the agreement at each one is called autocorrelation. With 100 measurements per second, a shift of 50 frames means 120 BPM. A second strong match at 100 frames means 60 BPM. [8]
In the formula below, is the onset score at frame , is the number of frames, and is the shift. Each product compares two scores frames apart.
A comb filter tests a period another way. It mixes the current signal with a delayed version so regularly spaced accents reinforce one another. Scheirer runs filters tuned to different periods across several frequency bands. A tempogram shows which rates are strongest as the analysis window moves through the track. A longer window helps distinguish nearby rates. A shorter one follows a DJ’s tempo change sooner. During an intro with no clear pulse, several candidate rates and their strengths can be more informative than one BPM reading. [6, 8, 9, 10]
3. beat tracking
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 , counting from zero, falls at . Here is the beat spacing, and 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]
Grid aligned to the beat.
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]
4. downbeats and meter
Start a house track in the middle and tap along. You may have the beat before you know which tap to call “one.” A bar (or measure) groups beats into a repeating count. In 4/4 there are four quarter-note beats to a bar. The downbeat is the first of those four. Four identical kicks give you four equally good places to start counting. Add claps on two and four and you can narrow it down to two. If the bass line starts over on one, you have a way to tell one from three. [18]
Counting from a known one
With a steady beat grid, the simplest bar tracker lets someone mark one downbeat. It then counts “one, two, three, four, one.” If it misses a beat, the next “one” comes a beat late and every later bar stays shifted. An automatic alternative is to try all four starting positions over several bars. Davies and Plumbley compare the sound from one beat to the next, paying particular attention to the low frequencies. Repeated changes in the bass at the same place in the count favor that bar alignment. [18]
Keeping several counts
A probabilistic tracker gives each possible count a weight. A bass change might raise the weight for “one.” The order of the beats supplies another clue. In 4/4, “four” normally leads to “one.” Those two pieces, what the sound suggests and which step can follow which, form a model of the bar. On a recording, the Viterbi algorithm finds the most probable sequence of positions under that model. A live particle filter follows a sample of possible counts and tempi, giving more weight to those that fit each new piece of audio. [19, 20]
A four-count also builds in an assumption about meter, the pattern of beats in a bar. In 6/8, a listener might tap twice, with three eighth notes to each tap. Seven eighth notes might group as 2+2+3 or 3+2+2. The bar lasts the same time in both patterns at the same eighth-note speed, but the accents move. Holzapfel and colleagues tested models of those accent patterns across eight musical styles, including music in 7/8 and 9/8. [2, 21]
5. phrase boundaries
Listen to the first word of a chorus. The singer may come in on the “and” before the band lands on one. Where does the new idea start? If you’re following the vocal, mark the first syllable. If you’re changing the lights for the chorus, mark the downbeat. A phrase is a group of notes heard as one musical idea. A section is a larger part of the arrangement, such as a verse, chorus, or breakdown. A DJ’s cue point is a choice about when to act. One transition can reasonably have three different timestamps. [22, 23, 24]
Following a melody
Try humming a melody and notice where you leave space to breathe. A rest, a held note, or a leap in pitch can all suggest a phrase ending. Cambouropoulos’s Local Boundary Detection Model gives each gap between notes a score based on changes in pitch and timing. [25] Rodríguez López and Volk survey methods that work from a symbolic melody, meaning a sequence of notes with pitches and times. To use such a method on a full mix, someone or something first has to pick out that melody. [26]
Counting bars
A DJ might count four, eight, or sixteen bars to predict when a pattern will repeat. For a four-bar synth line, a cue every four bars works as long as you know where the line began and its length stays the same. Extend the buildup by two bars and the projected drop comes two bars early. Four beats to a bar tells you nothing certain about the number of bars in a phrase. The Raveform researchers use recurring bar groups as a guide when labeling EDM sections. Jiang and colleagues model hypermeter, the way stronger and weaker bars can themselves form a repeating pattern. Their audio method takes beat and downbeat information as a starting point. [27, 28]
Looking for a change or a return
When a thin snare roll gives way to a full kick and bass, the sounds on each side of the drop differ sharply. Foote’s novelty method compares short stretches within each side and across the proposed boundary. A high score means each side sounds fairly consistent on its own and the two sides sound different. A short comparison can pick up a drum fill. A longer one can pick out a change of arrangement. [22, 29]
Methods based on homogeneity look for passages that sound consistent throughout. Recurrence offers a different clue. The second chorus can sound much like the first, even with a different verse in between. McFee and Ellis link similar moments across the track as well as neighbors in time. They use spectral clustering, a way of finding groups in that network of links, to recover repeated sections. The open-source Music Structure Analysis Framework (MSAF) includes several methods that can be compared on the same recording. [30, 31]
There is a cost to comparing both sides of a transition. Vande Veire and De Bie use four bars before and four after each candidate. At 124 BPM in 4/4, those later sixteen beats occupy 7.74 seconds. A file analyzer can work out where the drop was. By the time a live system has heard those four bars, the moment for the cut has passed. [11]
What a model learns also depends on what people marked in its training recordings. All-In-One learns section labels such as verse and chorus. FaiSonic MMD marks local phrases and larger sections separately in 500 pop recordings, including vocal phrases that start before a new bar. That distinction matters if the visual is supposed to follow the singer. [23, 32]
6. neural methods
Give a program a recording and a list of the times someone tapped along. Repeat that across many recordings. A neural network can learn which patterns in the audio tend to coincide with those taps. Change the training labels to the first beat of each bar and you teach it a different task. A single BPM label for a whole excerpt teaches it the rate, but leaves open where the beats fall. [19, 33]
Most of the systems below start from a spectrogram, a picture of how the strength of different frequencies changes over time. One model might read the whole picture and choose a BPM. Another gives each brief slice a score for “beat here” and “downbeat here.” A decoder turns those scores into timestamps. It can pick the tops of the peaks or use a model of how beats and bars follow one another. Jia, Lv, and Liu review this second approach. Beat This! is an example of the first. [34, 35]
| System | What it learns and when it can answer |
|---|---|
| Tempo-CNN | Looks at 11.9 seconds of audio and chooses a tempo. It uses a mel spectrogram, which groups high frequencies more broadly than low ones. Repeating the measurement along a track shows changes in tempo. [33] |
| madmom | A recurrent network carries information from one slice to the next. This one reads the recording in both directions. A dynamic Bayesian network (DBN) weighs the scores against likely sequences of beats and bar positions. [19] |
| BeatNet and BeatNet+ | Use only the audio heard so far. This makes them causal and suitable for live use. Two particle filters follow beat timing and bar position. BeatNet+ also trains on mixes with quieter drums to learn cues that survive when percussion drops out. [20, 36] |
| Beat Transformer | Separates the mix into instrument parts. Attention lets the model weigh which moments and parts are most relevant to the current beat, including bass or harmony when the drums give little away. [37] |
| Beat This! | Uses convolution to recognize local patterns and attention to relate events farther apart. It picks beats and downbeats from peaks in its scores after analyzing the file. [35] |
| Beat This! Live | Moves the target marks earlier during training. The live model learns to anticipate a beat, giving the peak picker time to confirm it. [38] |
| All-In-One | Learns beat times, downbeats, section boundaries, and labels such as verse and chorus together. It uses separated instrument parts from a recording. [32] |
On the GTZAN collection of recordings, the Beat This! Live authors reported F1, a score that accounts for missed beats and extra guesses. Their large model scored 86.7% for beats and 74.1% for downbeats. BeatNet+ scored 80.6% and 56.5% under the same test. To use either model live, I’d also want to know how early it could announce the next beat. [38]
madmom, BeatNet, and Beat This! all publish code and trained models. For reuse in an app, madmom lists a BSD license for the code and a separate Creative Commons Attribution-NonCommercial-ShareAlike license for its models and data. [19, 20, 35]
7. audio visualization
On a projection screen, a circle can swell with the bass, turn once per beat, or disappear on the first beat of a breakdown. The first effect needs a measure of the bass level. To turn at a steady rate through a missing kick, the second needs a beat clock. To time the cut, the third needs to know where the bar begins and what is changing in the music. A waveform or a spectrum display can simply draw what it hears. audioMotion-analyzer is an open-source example of a browser spectrum display. [2, 39]
Mapping sound to motion
A simple mapping gives a visual property to a measured feature. For example, let the bass level set a circle’s radius and the hi-hats set its line width. projectM and its browser counterpart Butterchurn expose bass, midrange, and treble levels to MilkDrop-style animations. Averaging several readings smooths out jitter, at the cost of a slower response to a sharp hit. Meyda supplies browser measurements such as RMS and spectral centroid, the average frequency weighted by strength, often used as a measure of brightness. [40, 41]
Aguilera and colleagues built a system for EDM that follows how energy shifts between frequency bands. Rules track whether the music has entered or left a break. In their 3D animation work they link quick movements to the rhythm and describe using a section change to switch scenes or move the camera. [42, 43]
Where the clock comes from
With a loaded file, an app can analyze the track before the set and schedule its cuts against playback. Essentia’s RhythmExtractor2013 uses statistics from the whole recording to place beats. A DJ setup may already have a clock. Ableton Link shares tempo and phase between applications, Traktor lets a performer realign the downbeat, and Beat Link Trigger can read prepared phrase information from compatible equipment. With only a live audio feed, a tracker such as BTrack has to estimate the clock from what has played so far. [15, 44, 45, 46, 47]
When the audience sees it
The app may hear system audio through Windows loopback capture, which records what is being played through an output device, or through a browser share that includes audio. The sample time of a kick, the moment its beat is reported, and the moment a projector shows the flash are three different times. In a browser, Web Audio’s getOutputTimestamp() connects the audio output clock to the clock used for drawing. A screen refreshing 60 times per second has a new frame about every 16.7 ms. To measure the final offset, record a test click and its matching flash together and compare when each actually arrives. [16, 48, 49]
8. evaluation
Imagine a tracker that marks every kick exactly 60 milliseconds late. If the test accepts a mark within 70 ms on either side of each beat, every mark can count as correct. Each flash is still late by the same amount. To read an accuracy score, you need to know what listeners marked, how close a prediction had to be, and whether the tracker had already heard the rest of the song. [50]
What counts as a match?
Pair each prediction with at most one listener mark inside the allowed time window, and use each mark at most once. Precision is the fraction of predictions that match. Recall is the fraction of listener marks the tracker finds. Suppose a loop has eight beats, and the tracker finds all eight plus two extra hits. Precision is 8/10, recall is 8/8, and their harmonic mean, called F1, is about 89%. A tracker that fires on every hi-hat can have excellent recall and poor precision. [50]
| Target | What the score tells you |
|---|---|
| Tempo | Accuracy 1 commonly accepts a BPM within 4% of the reference. Accuracy 2 also allows related rates, including half and double. For a 120 BPM track, a 60 BPM estimate can pass the second test. [6] |
| Beats and downbeats | F1 counts individual matches. A continuity score asks how long the tracker stayed on the same pulse without slipping. CMLc measures the longest correct run at the listener’s chosen beat level. AML scores also allow other interpretations, such as half speed. [50] |
| Phrases and sections | Report how close the starts were allowed to be and which kind of start was labeled. The FaiSonic preprint reports phrase F1 of 62.90% within half a second and 79.18% within three seconds for the same model. At 124 BPM, three seconds is more than six beats. Naming the new passage “chorus” is a separate test. [22, 23] |
| Live cues | Log both the time assigned to the beat and the time the software announced it. Compare each with the listener’s mark to see how accurate the timestamp was and whether the app had any advance notice. Also record how long the tracker took to settle at startup. [16, 38, 49] |
Whose annotations?
An annotation is a person’s mark on a recording, such as a beat timestamp or the beginning of a chorus. GiantSteps Tempo supplies reference tempi for 664 EDM excerpts. The Harmonix Set marks beats, bars, and sections in 912 pop tracks. Raveform includes human-marked sections for 1,423 EDM tracks, including buildups and drops. FaiSonic separates phrases from sections. Holzapfel and colleagues deliberately selected excerpts on which trackers disagreed, then asked listeners to mark them. Results on that collection reflect a harder selection of music. [10, 23, 27, 51, 52]
Testing a live cue
Play a file to the tracker a small block at a time, in order, as if it were coming from a DJ. Start mid-bar and count how many beats pass before the tracker finds one. Mute a kick and see whether the pulse carries through. Change the tempo and time how long it takes to follow. Log early and late errors separately. For a loop tied to the beat, a long uninterrupted run matters. For a single cut on the drop, what matters is whether the right cue reached the screen on that particular one. [16, 20, 50]
References
- [1]Bello et al. A tutorial on onset detection in music signals. IEEE, 2005.
- [2]Gouyon & Dixon. Computational rhythm description. ISMIR tutorial, 2006.
- [3]
- [4]Böck & Widmer. Maximum filter vibrato suppression for onset detection. DAFx, 2013.
- [5]Gouyon & Dixon. A Review of Automatic Rhythm Description Systems. Computer Music Journal 29(1), 2005. University repository
- [6]Schreiber, Urbano & Müller. Music tempo estimation: Are we done yet? TISMIR, 2020.
- [7]Dixon. Evaluation of the audio beat tracking system BeatRoot. Journal of New Music Research, 2007.
- [8]Müller. Fourier and autocorrelation tempograms. Fundamentals of Music Processing notebooks. Fourier notebook
- [9]Scheirer. Tempo and beat analysis of acoustic musical signals. JASA, 1998.
- [10]Holzapfel et al. Selective sampling for beat tracking evaluation. IEEE, 2012.
- [11]Vande Veire & De Bie. From raw audio to a seamless mix: creating an automated DJ system for drum and bass. EURASIP, 2018. Publisher’s full text
- [12]Allen & Dannenberg. Tracking musical beats in real time. ICMC, 1990.
- [13]Goto & Muraoka. Real-time beat tracking for drumless audio signals. Speech Communication, 1999. Author’s PDF
- [14]
- [15]
- [16]Meier, Chiu & Müller. A Real-Time Beat Tracking System with Zero Latency and Enhanced Controllability. TISMIR, 2024. Code and live demos
- [17]
- [18]Davies & Plumbley. A spectral difference approach to downbeat extraction in musical audio. EUSIPCO, 2006.
- [19]Böck, Krebs & Widmer. Joint beat and downbeat tracking with recurrent neural networks. ISMIR, 2016. Code and model licenses
- [20]Heydari, Cwitkowitz & Duan. BeatNet: CRNN and particle filtering for online joint beat, downbeat and meter tracking. ISMIR, 2021. Streaming code
- [21]
- [22]
- [23]Zhang et al. FaiSonic MMD: a popular music dataset with temporally aligned multidimensional annotations for multitask music analysis. Preprint, November 2026.
- [24]Argüello, Lanzendörfer & Wattenhofer. Cue point estimation using object detection. 2024.
- [25]Cambouropoulos. The Local Boundary Detection Model (LBDM) and its application in the study of expressive timing. ICMC, 2001.
- [26]Rodríguez López & Volk. Automatic Segmentation of Symbolic Music Encodings: A Survey. Utrecht University, UU-CS-2012-015, 2012.
- [27]
- [28]Jiang et al. Deep self-supervised hierarchical metrical structure modeling. ICASSP, 2023. Earlier symbolic model
- [29]Müller. Novelty-based segmentation. Fundamentals of Music Processing notebooks. Foote’s original paper
- [30]McFee & Ellis. Analyzing song structure with spectral clustering. ISMIR, 2014.
- [31]Nieto et al. Music Structure Analysis Framework. Python.
- [32]
- [33]Schreiber & Müller. A single-step approach to musical tempo estimation using a convolutional neural network. ISMIR, 2018. Repository
- [34]Jia, Lv & Liu. Deep learning-based automatic downbeat tracking: a brief review. Multimedia Systems 25, 2019. Preprint
- [35]Foscarin, Schlüter & Widmer. Beat This! Accurate beat tracking without DBN postprocessing. ISMIR, 2024. Code and weights
- [36]Heydari et al. BeatNet+: real-time rhythm analysis for diverse music audio. TISMIR, 2024. Repository
- [37]Zhao et al. Beat Transformer: demixed beat and downbeat tracking with dilated self-attention. ISMIR, 2022.
- [38]Juhász, Widmer & Schlüter. Beat This! Live: online beat and downbeat tracking by predicting the future. ISMIR, 2026. Code and weights
- [39]audioMotion contributors. audioMotion-analyzer. JavaScript.
- [40]projectM contributors. projectM preset authoring guide. MilkDrop-compatible visualizer. Browser implementation · Butterchurn
- [41]
- [42]Aguilera et al. Low cost algorithm for online segmentation of Electronic Dance Music. AES, 2018.
- [43]Aguilera et al. Electronic Dance Music Analysis for Real-Time Synchronization of 3D Video Animations in Live Events. WAVES 10, 2018.
- [44]Music Technology Group, Universitat Pompeu Fabra. Essentia rhythm extraction and Essentia.js. Essentia.js
- [45]
- [46]Native Instruments. Syncing Traktor to other applications via Ableton Link. Traktor.
- [47]
- [48]MDN & Microsoft. System audio capture on the web and Windows. Platform documentation. WASAPI loopback
- [49]
- [50]
- [51]Knees et al. GiantSteps Tempo. ISMIR, 2015.
- [52]Nieto et al. The Harmonix Set. ISMIR, 2019.