Most music editing programs will tell you the BPM of a song, but how do they calculate it? Obviously they try to find some sort of constant pulse throughout the song, but:

  • how are they separate from other sounds? How is a 'beat' found in the audio?
  • How are tempo changes handled, are they averaged together or is it based on longer duration of a specific tempo?
  • How would BPM calculation be different for say, an acoustic guitar solo (harder) than from a pop song (easier)?

(if we had the community wiki for questions back I'd invite people to edit in their own questions so this can serve for a more complete reference)

  • 3
    If you want a question to be community wiki, you could ask a moderator to convert it to a community wiki question. But I don't feel that this question would benefit from being community wiki, as knowledge of BPM calculation is an expertise worth the reputation and only a very small amount of users know something about it.
    – Tom Wijsman
    Dec 24, 2010 at 20:43

1 Answer 1


How are they separate from other sounds? How is a 'beat' found in the audio?

It basically amounts to emphasizing the sudden impulses of sound in the song and then finding the fundamental period at which these impulses appear. This is done by breaking the signal into frequency bands, extracting the envelope of these frequency-banded signals, differentiating them to emphasize sudden changes in sound, and running the signals through a comb-filterbank and choosing the highest energy result as our tempo.

Beat This - Beat Detection Algorithm

The first three steps should be easy to understand, let's look at the last step:

A comb filter adds a delayed version of a signal to itself, causing constructive and destructive interference. The frequency response of a comb filter consists of a series of regularly-spaced spikes, giving the appearance of a comb.

Wikipedia - Comb filter

The last step uses such a comb filter to figure out the BPM, as you can see on this graph (145 BPM spike):

alt text

You also see a spike at 72,5 BPM, the inference pattern also creates spikes at the half and double frequencies. This is the reason that software sometimes picks the half or double BPM instead of the real BPM.

GameDev.net - Beat Detection Algorithms explains the whole thing in more depth.

How are tempo changes handled?

Most algorithms don't support tempo changes, they will either pick a part in the middle to determine the BPM or decide to calculate an average BPM as you suggested. From a DJ perspective I haven't seen an algorithm yet that supports mixing two songs with a dynamic BPM...

How would BPM calculation be different?

This doesn't depend on instrument or genre, but rather how it is played. For example, in an electro pop song the algorithm can easily be confused in a bridge part of the song or due to some kind of due to those overused digital effects. For the guitar, if you play a classic part with accurately timed notes it would be easy for the algorithm do determine the BPM you are playing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.