how to detect pitch of microphone buffered data?

Jan 3, 2013 at 8:53 AM

i downloaded this project and run the program and i found its good.

but what i want to do is track pitch from microphone buffered data . i'm new to this digital sound so can you help me out.

i found this code on source to detect pitch.

 m_curWaveAngle = PitchDsp.CreateSineWave(m_audioBuffer, m_audioBuffer.Length,
                m_sampleRate, this.GeneratorPitch, this.GeneratorAmplitude, m_curWaveAngle);



WHere m_audioBuffer  is float type but microphone buffer data is in byte format  so how can i convert byte to float or is there any other idea please tell me

Jan 25, 2013 at 2:07 PM
Edited Jan 25, 2013 at 2:07 PM


private static float[] bytesToFloats(byte[] bytes){
            float[] floats = new float[bytes.Length / 2];
            for (int i = 0; i < bytes.Length; i += 2)
                floats[i / 2] = bytes[i] | (bytes[i + 1] << 8);
            return floats;