As in my last question AttributeError: 'module' object has no attribute 'spectrogram', I'm writing a little python script which reads a Wav Audio File, computes the spectrogram and writes the corresponding data back into a Wav File again. Here's a bit of code:
Scipy Code:
windowSize = 512
nOverlap_py = 160
nFFT = 1024
Fpy,Tpy,Spy=signal.spectrogram(s_orig_py,fs=fs_rate,window='hamming',nperseg=
windowSize,noverlap=nOverlap_py,nfft=nFFT,detrend=False,mode='complex')
The First 10 Elements of Scipy:
The Last 10 Elements of Scipy:
Matlab Code:
[S,F,T] = spectrogram(s_orig,window,nOverlap,fftParams.nFFT,fs);
The First 10 Elements of Matlab:
The Last 10 Elements of Matlab:
In both cases the parameters are the same. There is just a little problem: The values of Spy are not even close to the values of S and I don't understand why. I get that they can't be identical due the fact that both functions use a different algorithm to compute the FFT but as I mentioned before they are not even close.
Furthermore with Matlab, the resulting Wav File sounds 'exactly' the same as the original. With python it's just noise.