Question

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 !

Was it helpful?

Solution

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

Recreated using MATLAB's pwelch function:

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

MATLAB Version

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top