In this thread I explained a very simple and rudimentary way to determine the direction of a sound when recorded with two microphones. It was about comparing the left channel and the right channel signal and finding out how much they were time shifted from each other.

A similar simple approach can be used to find out the frequency of a tone in one single monophonic recording. It's kind of the YIN algorithm very much simplified, or a small part of it. If there's an audible pitch of a sound, say C4 or middle C, there's aparticular wave length that can be found. Say you have 1000 samples of sound, sampled at 44.1 kHz, which means the 1000 sample sound lasts 22.6 milliseconds. It's very short, but it might contain some 10 wavelengths, if your tone is around 400 Hz. You just have to find the length of a wavelength to calculate the frequency of the tone. If you can assume your frequency is in the range 200 Hz - 800 Hz, you could start with 800 Hz. That would have a wavelength of 55 samples. Take sample #0 and subtract it from sample #55. Square the difference. Add it to a sum. Advance to sample #1 and sample #56 and continue, until you've summed the squared difference of all samples in two

*assumed* consequtive waves. Save the sum. Then start all over with samples #0 and

*#56*. Save this sum. This assumed wavelength would correspond to 787.5 Hz. After counting the sums of the squared differencies of all possible wavelengths from 56 samples to 224 samples, you can pick the one with the least sum (You have to divide each sum with the number of samples to make them comparable). The least sum corresponds to the frequency of your tone.

To add accuracy, run through the whole 1000 sample long sound, find all waves and get an average of them, discarding waves that deviate too much from an average - they are just noisy.