import wave
import numpy as np 
import pylab as plt
f=wave.open("./train/1.wav")
params=f.getparams()
nchannels, sampwidth, framerate, nframes = params[:4]
str_data=f.readframes(nframes)
f.close()
wave_data=np.fromstring(str_data,dtype=np.short)
wave_data.shape=-1,2
wave_data=wave_data.T
time=np.arange(0,nframes)/framerate
print(params)
plt.figure(1) 
plt.subplot(2,1,1) 
plt.plot(time,wave_data[0])  
plt.subplot(2,1,2)  
plt.plot(time,wave_data[1],c="r")  
plt.xlabel("time")  
plt.show() 