MATLAB: Spectrogram of a song

helpsongspectrogram

Hi, I'm trying to graph the spectrum of an audio, but when I use the spectrogram function it appears that my song is not written as vector and i dont know how to fix it. Can somebody help me please.
Code:
[x,fs]=audioread('estrellita.mp3');
window=hamming(100,'periodic')
spectrogram(x,window)

Best Answer

Your song may be a two-channel stereo file. Stereo files are (Nx2) matrices.
Try this:
[x(:,1),fs]=audioread('estrellita.mp3');
window=hamming(100,'periodic')
spectrogram(x,window)
then this:
[x(:,2),fs]=audioread('estrellita.mp3');
window=hamming(100,'periodic')
spectrogram(x,window)
to see what works best for you.
Related Question