Domanda

I have an audio file, that I analyse with audacity and the spectrum look like :

audacity

I would like to get the same with scilab so I've run this code :

[y,Fs] = wavread('fileName.wav');
Y_0 = abs(fft(y(1,:),-1));
plot(fftshift(Y_0));

and the result is : scilab result

I tried this as well :

plot(10*log10(fftshift(Y_0)));

the result was different but still not the same as audacity, any idea how to do it ? thanks in advance for any help !

È stato utile?

Soluzione

Audacity's spectrum is actually a periodogram, which is an estimate of spectral density. Try using the pwelch function. Here is my Audacity frequency analysis:

Audacity's image

Recreated using MATLAB's pwelch function:

[y, fs] = wavread('inputfile.wav');
pwelch(y, hanning(512))

MATLAB Version

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top