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]:
In [103]:
r[2][32:64, 60481:60481+64].imag.max()
Out[103]:
In [104]:
r[2][:32, 60481:60481+64].imag.max()
Out[104]:
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]:
In [12]:
r[2].imag.min()
Out[12]:
In [13]:
s=istft(r[2], fs)
In [14]:
s[1].dtype
Out[14]:
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]: