from scipy import signal
sample_rate, s = scipy.io.wavfile.read("data/0_01_10.wav")
f, t, Zxx = signal.stft(s, fs=sample_rate,window='hann',nperseg=256,noverlap=None,nfft=None,
detrend=False,return_onesided=True,boundary='zeros',padded=True,axis=-1)
plt.figure(figsize=(20,10))
plt.subplot(2,1,1)
plt.plot(np.arange(len(s))/sample_rate, s)
plt.xlim([0, len(s)/sample_rate])
plt.subplot(2,1,2)
plt.pcolormesh(t, f, np.abs(Zxx), vmin = 0, vmax = 1)
plt.title('STFT Magnitude')
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.show()