Calculate autocorrelation using FFT in Matlab

Just like you stated, take the fft and multiply pointwise by its complex conjugate, then use the inverse fft (or in the case of cross-correlation of two signals: Corr(x,y) <=> FFT(x)FFT(y)*) x = rand(100,1); len = length(x); %# autocorrelation nfft = 2^nextpow2(2*len-1); r = ifft( fft(x,nfft) .* conj(fft(x,nfft)) ); %# rearrange and keep values corresponding … Read more

Note onset detection

Here is a graphic that illustrates the threshold approach to note onset detection: This image shows a typical WAV file with three discrete notes played in succession. The red line represents a chosen signal threshold, and the blue lines represent note start positions returned by a simple algorithm that marks a start when the signal … Read more