Frequency detection

Hi every body !
Hope you're having a great day !! :smiley:
I'm sorry to ask you this but can some one help me.
I need to detect the frequency played by a guitare string.
I planned to attach this preamplified microphone:

I need a code that allow me to detect a sound frequency and give me the result at the end.
I need to use this code to build an automatic guitar tuner.
I only using a mic, an continous servo and an arduino uno.
thanks alot !! :smiley:

Going to make a robot tuner like this?

If you have a computer, you can download a program which will tell you which note you are playing.

See a similar project here, with link to code: The Deambulatory Matrix: Digital Chromatic Guitar Tuner (2008).

CROSSROADS that’s it !

#1- Most of the tuners built with Arduino are neither verified against a known source, nor or are they accurate. Be careful what you trust.
#2 - If you're using a regular arduino, your options are limited to basic time domain methods. Autocorrelation functions (ACF) and YIN (an advanced form of ACF) are possible, but you'll still have to probably employ a table look up of some sort to guess your instrument's pitch. Depending on your sampling rate, you won't be able to resolve higher frequencies even if you employed something like quadratic interpolation. To avoid octave and harmonic errors, a bit of adaptive low-pass filtering can also be used.

If you're working on one of the more powerful (32 bit) Arduino's, you could also try to employ methods involving the FFT. Harmonic Product Spectrum, the Phase Vocoder (not like a talkbox type vocoder), and general spectral peak picking are all good ways to go about it. Just realize, that using any of these methods you should use doubles in software to retain as much accuracy as possible, even if the hardware doesn't have a floating point unit.

There is a lot of good information on these types of things floating around on the Stanford CCRMA and J.O.Smith III websites.