Finding the Pitch of a Wave file

3c164bf379a317a621969b24c882744f
0
Sarlacc 101 Nov 27, 2008 at 12:46

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.

Thanks

2 Replies

Please log in or register to post a reply.

6f0a333c785da81d479a0f58c2ccb203
0
monjardin 102 Nov 27, 2008 at 15:03

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.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Nov 27, 2008 at 18:42

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.