As others have said, a musical "pitch" such as the A4 note played by a flute for example, is composed of many audio "frequencies", namely the fundamental A4 tone of 440 Hz, and many overtones (also known as harmonics.)
The overtones are integer multiples of the fundamental tone. In this example the fundamental tone is 440 Hz and the overtones are 880, 1320, 1760 Hz and so on.
You will understand much better the relationship between pitch and frequency by looking at the actual frequency spectra of several musical instruments.
You can see the frequency spectra here: Musical instrument spectrum
When you look at a musical instrument spectrum using the above tool, you are looking at the output of an FFT (a Fast Fourier Transform). The FFT was used to process the digitally recorded sound produced by the musical instrument.
The FFT transforms the audio signal of the musical instrument, from the time/sound_pressure domain, to the frequency/frequency_magnitude domain.
The FFT automatically produces magnitudes for "negative frequencies", in addition to magnitudes for the "normal" positive frequencies. No need to discuss that here, but to see only the "normal" positive frequencies, click the "Un-Fold w" button.
The above tool shows FFT magnitudes in decibels (by default). A decibel is a stretched version of a "normal" linear magnitude. Decibel graphs let you to see very large and very small magnitudes on the same graph.
If you want to see only the frequencies with the largest magnitudes, click the "FFT Y-Axis Magnitude" menu, and select "Sqrt(R^2+I^2)" at the top of the menu.
To go back to the decibel graph, select "dB Norm Sqrt(R^2+I^2)" in the same menu.
Click the "Play" button to hear the recorded sound of the selected instrument, playing the selected note.
Click the "Inv-FFT" button to see the time/sound_pressure signal that was recorded for the selected instrument and note.
By the way, Inv-FFT performs an actual inverse FFT. It actually synthesizes the original time/sound_pressure signal from the frequency/frequency_magnitude data.
Click the "FFT" button to again see the spectrum.
Use the zoom-in and zoom-out buttons to select a zoom mode. Then drag a box around the part of the graph you want to zoom-in or zoom-out. Click the zoom button again to return to unzoomed mode.
For your tuner, you'll have to:
- process the input signal (the instrument sound) with the FFT.
- detect the fundamental peak.
- determine how far away the peak is from the desired pitch, A4's 440 Hz for example.
- display the difference to the user.
Problems you'll encounter:
- background noise in the input signal.
- user's instrument is badly out of tune (bad instrument).
- user is trying to tune chords instead of single notes (bad user).