PIC pitch detector

Discussion in 'Embedded Systems and Microcontrollers' started by prescott2006, Feb 2, 2010.

  1. prescott2006

    Thread Starter Active Member

    Nov 8, 2008
    can i use PIC to detect the pitch? i do not need to correct the pitch, just to detect the frequency and display it on LCD. How should i start with?
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    No parameters given or type of PIC to use.

    Convert the frequency to a logic level pulse train. Use a pin as an input and use the pulses to count up a value. If you can control the counting period accurately, then the accumulated count scales to frequency.
  3. SgtWookie


    Jul 17, 2007
  4. prescott2006

    Thread Starter Active Member

    Nov 8, 2008
    basically, there are no constraint on PIC used. but preferable is PIC16F84, or PIC16F877. So after i googling, i found that some algorithm such as autocorreration, Cepstrum analysis can detect the pitch. does that mean that i need to use them?

    i thought frequency counter is to display the frequency of the device input, but what i wish to do is input voice signal into microphone and after process by PIC somehow then display it on LCD.
  5. mik3

    Senior Member

    Feb 4, 2008
    A bandpass filter will be needed after the microphone to pass only the required pitch. Then a copmarator will monitor when the output signal of the filter passes through its bias point and produce pulses. As mentioned in the previous answers, you can count the pulses per a unit of time and calculate the signals frequency. If you know how to implement the filtering and comparison digitally, you can use a DSP PIC and reduce the components of the circuit.
  6. prescott2006

    Thread Starter Active Member

    Nov 8, 2008
    hmm,can i use PIC to implement autocolleration? i google but cannot found any example on that.
  7. Markd77

    Senior Member

    Sep 7, 2009
    Audio pitch detection on a small pic is going to be unlikely. There are so many harmonics which makes most methods very tricky. Heavy filtering will work for a narrow range (less than an octave). This is really a PC application although it is possible a DSPic might manage it. The programming will be hard though. I believe a fast fourier transform may be a possible option.