1

I took a file which was a clean, repeating waveform of the note F2 (I deduced this by playing F2 on the virtual piano and playing the wave fle, and comparing) on a piano. When I did the fft of the signal, by using wavread of the saved wav file, I got a peak frequency of 176.4 Hz, which is one octave off the correct frequency of the note F2.

When I analysed another note, this time recorded from a physical piano, I got the exact same peak frequency. How is this possible? It is possible that MATLAB stores the peak frequency in its memory for more than one file? If so, how do I solve this problem?

P.S. when we analysed a full song, i.e. a wav file containing many notes, we got many peaks, which confirmed that we weren't using the same graph for everything.

  • 5
    You need to understand what *pitch* is - just because a complex sound such as a piano note has a certain *pitch* this doesn't mean that the max peak in the power spectrum will be at this frequency. See: https://en.wikipedia.org/wiki/Pitch_(music) – Paul R Mar 06 '13 at 08:33

1 Answers1

1

It's not an error in Matlab's FFT.

Musical pitch is different from peak frequency. It's a psycho-acoustic phenomena. A sound that a human will hear as a single musical pitch can contain many frequency peaks, with the strongest spectral frequency peaks possibly being overtones that are centered on a completely different pitch class, and/or in a higher octave than the perceived pitch. There are books that cover this topic in areas such as audiology and the neuropsychology of sound perception. A book on the physics of music might explain why a piano creates this more rich and complicated frequency spectrum content.

To find pitch, one needs to use a pitch detection/estimation algorithm, not just an FFT. Search here using those keywords.

Community
  • 1
  • 1
hotpaw2
  • 70,107
  • 14
  • 90
  • 153