I'm having some trouble to understand the output of the FFT
of a piano note (A1, f=55 Hz
).
I was expecting to get a "strong" frequency at 55 Hz
, but instead I'm getting a "strong" frequency at 220 Hz
, which correspond to a A3
, two octaves up.
This is the code I'm using:
[audio,fs] = audioread('a1.wav');
audio = audio(:,1)./max(audio(:,1));
dt = 1/fs;
t = linspace(0, length(audio)/fs, length(audio));
T = max(t);
fftAudio = fftshift(fft(audio));
mfft = abs(fftAudio);
pfft = angle(fftAudio)*(180/pi);
f = linspace(-fs/2,fs/2,length(fftAudio));
%%
figure,plot(f,mfft,'m.-'),grid on
xlim([0 fs/2])
Either I'm doing something wrong of somehow MATLAB "ignores" the low frequencies. There's the FFT:
This is zoom in FFT:
Does anyone know why this is happening? Thank you.
plot
command doesn't correspond to the figure you're showing. Please show how you plotmfft
. – Cris Luengof = -fs/2:fs/Nfft:fs/2-fs/Nfft;
– TwistedSim