How to detect the BPM of a song in php

haresh picture haresh · Mar 18, 2009 · Viewed 88k times · Source

How can the tempo/BPM of a song be determined programmatically? What algorithms are commonly used, and what considerations must be made?

Answer

John Feminella picture John Feminella · Mar 18, 2009

This is challenging to explain in a single StackOverflow post. In general, the simplest beat-detection algorithms work by locating peaks in sound energy, which is easy to detect. More sophisticated methods use comb filters and other statistical/waveform methods. For a detailed explication including code samples, check this GameDev article out.