In [1]:
from scipy.io import wavfile
fs, data = wavfile.read("A.wav")

In [2]:
x = data/data.max()

In [3]:
from scipy.signal import stft, istft

In [29]:


In [32]:
%matplotlib inline

In [33]:
import matplotlib.pyplot as plt

In [98]:
r =stft(x, fs=100, nperseg=256, return_onesided=True)

In [99]:
from scipy.fftpack import dct, idct

In [102]:
plt.imshow(r[2][32:64, 60481:60481+64].imag)


Out[102]:
<matplotlib.image.AxesImage at 0x7f3cb0ef43c8>

In [103]:
r[2][32:64, 60481:60481+64].imag.max()


Out[103]:
0.00075166500444117062

In [104]:
r[2][:32, 60481:60481+64].imag.max()


Out[104]:
0.036450673476274925

In [58]:
import numpy as np

In [74]:
h=r[2][:, 39481:39481+128]
plt.imshow(np.moveaxis([h.imag, h.real, h.imag],0,2))


Out[74]:
<matplotlib.image.AxesImage at 0x7f3cb1458160>

In [12]:
r[2].imag.min()


Out[12]:
-0.18217648560247296

In [13]:
s=istft(r[2], fs)

In [14]:
s[1].dtype


Out[14]:
dtype('float64')

In [15]:
y = s[1]*data.max()

In [17]:
y = y.astype('int16')

In [19]:
wavfile.write('a2.wav', fs, y)

In [25]:
r[2].real.std()


Out[25]:
0.0023244189607570199