Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: calculating the bpm of a song in mp3 format

by kvale (Monsignor)
on Apr 16, 2006 at 00:32 UTC ( #543604=note: print w/replies, xml ) Need Help??

in reply to calculating the bpm of a song in mp3 format

The algorithm I would use to calculate BPM is to
  1. calculate the modulation envelope of the waveform using either a Hilbert transform or rectification and smoothing
  2. compute the Fast Fourier Transform (FFT) of the modulation envelope
  3. look for the strongest peak in the 0.2-5Hz range (depending on the music)
  4. Assign the center of the peak to be the BPM.
Note that most music is approximately scale-free (or fractal, to use a more popular term) so that there will be energy at all time scales. But for some kinds of music there will be a prominent peak in the above range that people usually associate with BPM.

How to do all of this in perl? I would use PDL. It is very efficient in manipulating vector quantities like sound waveforms and has a built in FFT function.


  • Comment on Re: calculating the bpm of a song in mp3 format

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://543604]
[shmem]: just leaving it as is. After all, enough effort put into that. hrmpf.
[karlgoethebier]: shmem: ah i see: no inline styles in the approved html :-{
[shmem]: karlgoethebier, yep. Thanks anyways, post done, and esel happy :-)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-07-24 16:53 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (356 votes). Check out past polls.