plt.subplot(2,3,4) plt.plot(xacov) plt.title('autocovariance') nr = len(x)#*2/3 #xacovfft = np.fft.fft(xacov[:nr], 2*nr-1) xacovfft = np.fft.fft(np.correlate(x,x,'full')) #abs(xacovfft)**2 or equivalently xacovfft = xacovfft * xacovfft.conj() plt.subplot(2,3,5) if rescale: plt.plot(xacovfft[:nr]/xacovfft[0]) else: plt.plot(xacovfft[:nr]) plt.title('fft') if hastalkbox: sdpa, wpa = stbs.arspec(x, 50) plt.subplot(2,3,6) if rescale: plt.plot(wpa,sdpa/sdpa[0]) else: plt.plot(wpa, sdpa) plt.title('stbs.arspec') #plt.show()
import numpy as np import matplotlib.pylab as plt from scikits.audiolab import wavread from scikits.samplerate import resample from scikits.talkbox.spectral.basic import periodogram, arspec a, fs = wavread('voice-womanKP-01.wav')[:2] fr = 4000. ra = resample(a, fr / fs) frame = ra[500:500+256] px, fx = periodogram(frame, 2048, fr) plt.grid(True) plt.plot(fx, 10 * np.log10(px)) apx, afx = arspec(frame, 12, 2048, fr) plt.plot(afx, 10 * np.log10(apx))
xacov = acovf(x, unbiased=False) plt.subplot(2, 3, 4) plt.plot(xacov) plt.title('autocovariance') nr = len(x) #*2/3 #xacovfft = np.fft.fft(xacov[:nr], 2*nr-1) xacovfft = np.fft.fft(np.correlate(x, x, 'full')) #abs(xacovfft)**2 or equivalently xacovfft = xacovfft * xacovfft.conj() plt.subplot(2, 3, 5) if rescale: plt.plot(xacovfft[:nr] / xacovfft[0]) else: plt.plot(xacovfft[:nr]) plt.title('fft') if hastalkbox: sdpa, wpa = stbs.arspec(x, 50) plt.subplot(2, 3, 6) if rescale: plt.plot(wpa, sdpa / sdpa[0]) else: plt.plot(wpa, sdpa) plt.title('stbs.arspec') #plt.show()
import numpy as np import matplotlib.pylab as plt from scikits.audiolab import wavread from scikits.samplerate import resample from scikits.talkbox.spectral.basic import periodogram, arspec a, fs = wavread('voice-womanKP-01.wav')[:2] fr = 4000. ra = resample(a, fr / fs) frame = ra[500:500 + 256] px, fx = periodogram(frame, 2048, fr) plt.grid(True) plt.plot(fx, 10 * np.log10(px)) apx, afx = arspec(frame, 12, 2048, fr) plt.plot(afx, 10 * np.log10(apx))