Note detection in an audio file.
The pitch of a musical note is very often not the same thing as the frequency peak in an FFT magnitude computation.

This is due to all the overtones and harmonics within interesting musical sounds, as opposed to single pure (and boring sounding) sinewaves.  Please investigate pitch detection/estimation algorithms that do more than look for a bare FFT magnitude peak.  A little reading on human psychoacoustics, pitch perception, audiology, and the physics of musical instruments might also help.