I am trying to observe frequency spectrum of an audio (mp3) file on MATLAB. The file'abc.mp3' is a 14 second music clip
My MATLAB code is below:
clear, clc, close all; [y,fs] = audioread('abc.mp3'); N = length(y); % Length of vector y, number of samples Y = fft(y,N); % Fourier transform of y F = ((0:1/N:1-1/N)*fs); % Frequency vector w = 2*pi*F; % Angular frequency vector magnitudeY = abs(Y); % Magnitude of the FFT phaseY = unwrap(angle(Y)); % Phase of the FFT plot(F, magnitudeY); grid on; set(gca, 'FontName', 'Times New Roman', 'FontSize', 14); xlabel('Frequency, Hz'); ylabel('Magnitude, dB'); title('Magnitude spectrum of sound wave in frequency');
When i run above script, i see the attached plot in output but i am confused because the maximum frequency component appears to abe around 8000 hz while the output of '''audioread''' command (fs) is around 44100 hz, why this difference?