1

I am trying to figure out fundamental frequency of sound

I try to detect fundamental frequency with autocorrelation.

I found this code:

corr = np.correlate(signal, signal, mode='full')
maxcorr = np.argmax(corr)
corr = corr / corr[maxcorr]
corr = corr[corr.size / 2:]

I got this graph from the code above: enter image description here

index of maximum value is 3145. and my sample rate is 44100.

so... I got fundamental frequency 44100/3145 = 14.02.

This is way too wrong since the sound is Piano C4 which should be around 261Hz.

How can I get fundamental frequency with autocorrelation?

ADDED:

this is a graph of C4 of piano enter image description here

SounBum Song
  • 225
  • 1
  • 3
  • 11
  • Is your data simulated? I see no sign of noise which is not normal for real data. I would check the data first: plot it and make sure it is a sinewave with expected frequency... – Julien Apr 19 '16 at 02:36
  • Related question that may be of help: http://stackoverflow.com/questions/5044289/how-to-find-the-fundamental-frequency-of-a-guitar-string-sound?rq=1 – paisanco Apr 19 '16 at 02:39
  • I'd recommend plotting against `t = np.arange(corr.size) / 44100` for clarity – Eric Apr 19 '16 at 02:51
  • @JulienBernu I added C4 sound. this sound is extracted from Guitar Pro – SounBum Song Apr 19 '16 at 03:38

0 Answers0