Register to reply 
Finding the strongest beat in a sound wave using autocorrelation 
Share this thread: 
#1
Nov2612, 07:01 AM

P: 22

Hi everyone,
I have a sound wave representing a piano piece played at a steady tempo, and would like to get a graph of the saliency of each beat (essentially, a probability distribution for how strong each possible tempo is). I understand that this is done by plotting the autocorrelation function, however I don't quite understand why a graph of r coefficients against each possible lag value (which is, as far as I understand, the deffinition of an autocorrelogram) would have anything to do with beats. The following Matlab code produces a graph that doesn't in any way suggest anything to do with the actual steady beat of the piece (60 BPM):
The MIR toolbox for Matlab has a function specifically for finding the tempo of a waveform  however what I'm after now is understanding these things at a theoretical level. Anticipated thanks for any clarifications!! 


#2
Nov2612, 08:24 AM

Mentor
P: 11,890

Alternatively, search for steps in the autocorrelation function, this could help as well. 


#3
Nov2612, 09:13 AM

Sci Advisor
Thanks
PF Gold
P: 12,161

Problem with music is that it can be very subtle. However, to find an 'obvious beat', why not find the short term RMS values (Energy with time) of a long passage and FFT that to find low frequency (sub Hz) energy variations. Some prefiltering could identify components like cymbal strikes or bass drum beats. (Sound to light 'disco' boxes do this quite well)



#4
Nov2612, 11:22 AM

P: 22

Finding the strongest beat in a sound wave using autocorrelation
Thanks for your replies! I'm afraid I still don't fully understand, though, the link between a time signal's (waveform's) periodicity and its autocorrelation function; and, I could also add, the link between the signal's autocorrelation function and its Fourier transform (the latter of which I understand how it relates to pitch but not to rhythm)



#5
Nov2612, 01:11 PM

Sci Advisor
Thanks
PF Gold
P: 12,161

I am not sure that the ACF would necessarily reveal the rythm unless there were rhythmic repeats of the same instrument producing a note that was somehow phase consistent? It could be worth while trying with some actual examples of music. 


#6
Nov2612, 01:59 PM

P: 22

Thanks, that's quite helpful, I'll play around with it in Matlab on my own a bit to facilitate intuition :)



#7
Nov2612, 02:24 PM

Engineering
Sci Advisor
HW Helper
Thanks
P: 7,160

The autocorrelation for the audio of a complete piano piece probably won't show anything useful.
If you calculate autocorrelations for short "windows" of the data, you might be able to see the CHANGES in frequency content at the start of each new note. But even a single note on a piano is far from being a simple sine wave, and most piano music has several notes at different pitches sounding at the same time, so this isn't going to be easy to see. There are a few commercial computer programs that claim to be able to convert an audio recording into music notation, for example http://www.neuratron.com/audioscore.htm, but they don't work very well for anything except very simple audio, like a single instrument that can only play one note at a time. But it is possible ... http://www.ted.com/talks/john_walker...formances.html 


#8
Nov2612, 03:03 PM

Sci Advisor
Thanks
PF Gold
P: 12,161

If your task is to find a reliable method using DSP and not a brain, it will fall over for some examples, I'm sure. It would depend on how good it needs to be. Good luck and have fun.



#9
Nov2712, 10:37 PM

P: 2,251

better look up "beat detection" which is a similar problem to pitch detection. i would suggest googling jean larouche beat detection without quotes and reading any number of documents this guy wrote.
it ain't an easy problem. 


#10
Nov2812, 10:25 AM

Sci Advisor
PF Gold
P: 2,725




Register to reply 
Related Discussions  
Finding the beat frequency  Introductory Physics Homework  1  
Beat of sound  General Physics  2  
Question on finding the frequency of a sound wave  Introductory Physics Homework  1  
Sound Wave Intensity/Sound Level  Introductory Physics Homework  1  
Sound problem: Beat frequency  Introductory Physics Homework  2 