Use WaveIn to get Pitch (fft/autocorrelator).

Jan 22, 2012 at 1:24 AM

Hello, I'd like to know if it theres a way to get the autocorrelator/pitch using WaveIn or/and its DataAvailable event? Im study the VoiceRecorder project and i could only view the pitch when the recorded file is being read( on AutoTuneUtils class). Is it possible to get the pitch in realtime? Thank you..

Coordinator
Jan 24, 2012 at 12:20 PM

this was done for performance reasons as the autocorrelator is not particularly quick. However there is no reason why you couldn't pass samples into it as they arrived through DataAvailable.

Jan 25, 2012 at 10:37 AM

Can you give me example how to get autocorrelator/fft detectpitch on dataavailable?i checked the voicerecorder project. but it opens a wav file and passes to IWaveProvider. What i need is getting the pitch from a microphone in realtime. Thanks in advance.

Jan 27, 2012 at 12:45 AM

I am also interested on this...

Coordinator
Jan 27, 2012 at 6:14 AM

Well all that is needed is to make sure you have the right number of samples. Because of the use of FFT, you need a power of two. So you could set up your buffer sizes carefully so that each DataAvailable has exactly the right number of samples, or you could use a CircularBuffer and when you have enough pass a chunk of samples into the AutoCorrelator. Use Buffer.BlockCopy to go from byte[] to float[] (assuming you are recording in mono)