Are there any algorithms for automatically fitting a beat grid to a song (tempo matching) when the song has a slowly changing tempo or BPM?

The output would be a vector of onsets.

Here's a picture of fitting a grid to a waveform for a part of a song with a constant BPM:

enter image description here


I briefly worked on tempo and beat estimation for electronic dance music and used a couple of correlation techniques for this. Basically, I used a combination of auto correlation and cross correlation using a grid technique to find the tempo and then used the tempo to find the beats. This was for a constant tempo though. I'm not sure how well that would work on non-constant tempo. You can take a look at my code and detailed algorithm on my Github repo here.

As per the latest MIREX results (a worldwide competition for some music information retrieval tasks), you should check out the madmom library. They seem to have amazing results and use machine learning for their approaches.

What is your exact use case? Let me know if you find something useful.

  • $\begingroup$ There are lots of use cases. A big practical application would be for DJing music that wasn't originally recorded with a metronome or DJing music with tempo changes. $\endgroup$ – R Tyler McLaughlin Mar 1 '18 at 20:33
  • 1
    $\begingroup$ This algorithm would help you find out the tempo for the audio file but not help you change its tempo. For that, you may want to try PSOLA (phase synchronous overlap and add) for monophonic tracks and a phase vocoder approach along with resampling for polyphonic music. You might have to take care of the phase of transients while using the phase vocoder approach though. $\endgroup$ – Somesh Ganesh Mar 1 '18 at 20:50
  • $\begingroup$ I can't click on the upvote button... $\endgroup$ – endolith Jul 26 '18 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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