sarlacc at November 27th, 2008 07:46 — #1
I would like to know how to process the audio in a wave file to find what the pitch of the audio is. The file will just contain a person singing a single note at first. I am coding in VC++ and using Vista.
monjardin at November 27th, 2008 10:03 — #2
You could look for zero crossing points to calculate the period of the signal and then invert the value to get the frequency. This will fail for complex signals composed of multiple frequencies. So, I'd suggest using a Fast Fourier Transform (FFT) to convert the signal to a frequency spectrum and then analyze the magnitude of the frequency components. FFTW is great C library for doing so.
reedbeta at November 27th, 2008 13:42 — #3
Heh. I've actually been working on a program for this very purpose, but I'm not too far along with it (it's a more complicated problem than it seems at first, even with the FFT). I would recommend starting with whistling rather than singing or humming, as it gives a simpler spectrum, usually with only one peak. When you process singing or humming you get many peaks (harmonics) and it's nontrivial to identify which corresponds to the pitch of the note sung; you have to worry about formant frequencies and things like that.