This project has moved and is read-only. For the latest updates, please go here.

Comparing Simple Sounds - What is the Closest Frequency

Mar 5, 2011 at 1:34 AM

Hello everyone!

I have a rather interesting problem to solve.

I want to take a very simple sound (one note played on the piano) and try to process it in such a way that I can print out which note is most likely being played.

From some googling and searching I have come across the fast fourier transform but am not entirely sure how I would use this to analyze data from a wav file.


This is my idea of what to do so far:

Take a 1/10 second chunk of the file and count how many wave cycles are in that chuck.  To do this I could count the number of crests and troughs??

Then divide by the time. (tenth of a second) to get the frequency.


Any thoughts and ideas would be much appreciated.

Mar 7, 2011 at 7:34 AM


For starters, Ill give you a few helpful links. This is what I read and used to help me do 'pitch detection'. Basically, FFT is the way to go for what you want as it is simple and usually the basic approach to this:

Introduction to the Frequency Domain and the Fast Fourier Transform:


Mark Heath's article on using FFT for pitch detection (this is only one part of the article):


And then I just made my own code for translating frequency-pitch.

Feel free to ask some questions if you have problems.