You will need a pitch estimation algorithm (there have been many published, such as autocorrelation, ASDF/AMDF, cepstral processing, harmonic product spectrum, RAPT, YAAPT, etc.). Frequency estimation alone is not suitable for guitar tuning, as note pitch is different from spectral frequency.