I have a task to recognize a note that has been played by an instrument. From what i've read on the internet a good aproach to this problem is the FFT algorithm. It takes a wave input and splits it in multiple simple waves that when you sum them up they give you the original wave(decomposition). This part is clear.
I downloaded a .wav file that contains the piano note G that I want to recognize. I apply the FFT algorithm and obviously I get an output, from this step I am lost.
What do I need to do next to recognize the sound played ? I know i must transform this output in a frequency in Hz(as all notes have a frequency, unique if I am not mistaken). Which I can do like this:
[y,fs] = wavread('foo.wav');
ydft = fft(y);
% I'll assume y has even length
ydft = ydft(1:length(y)/2+1);
% create a frequency vector
freq = 0:fs/length(y):fs/2;
Now I have a vector named freq with the frequencies identified with the help of fft. How can I get the frequency of a note out of this vector?