Try to determine the start time and duration of each "beat" in an audio signal (circled in figure below). It looks like a simple question, and python or Matlab should have toolbox/functions to do this, just couldn't find them. I tried low pass filtering and freq analysis, but neither worked. enter image description here


The area you're asking about is called "Onset Detection" this is used all throughout signal processing, but most oven used in Music Information Retrieval to identify the start and stop to notes.

Music Sample of an Onset

While there are many ways to accomplish this lets consider two: energy and frequency domain.

Energy: We know that when there is a spike in a signal there is a marked increase in the energy of the signal. You could simply create sampling windows and calculate the average absolute energy of the window by tracking the area under the curve. When you see a large increase it means you've reached a peak (or close enough to an onset)

Frequency: We know that in the time domain, if a signal is high in amplitude and short in time it will have a wide spread in the frequency domain with most of that content in the higher end of the frequency spectrum. (Dirac function is a prime example of this)

You could cut your signal into small windows, calculate the FFT and detect when there is a large change in high frequency content.

These two methods are theoretically the same, however your implementation would result in different accuracy.

Here's a tutorial on many of the onset detection algorithms out there.


The beat is pretty abrupt and packs considerable signal power. Power thresholding after low pass filtering and wavelet transform are good options.

If you are more specific and attach some code we’d be able to help better.


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.