Jump to content


Finding the Pitch of a Wave file


2 replies to this topic

#1 Sarlacc

    New Member

  • Members
  • Pip
  • 1 posts

Posted 27 November 2008 - 12:46 PM

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 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 27 November 2008 - 03:03 PM

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.
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 5311 posts
  • LocationSanta Clara, CA

Posted 27 November 2008 - 06:42 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users