sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../software/models/')) import hprModel as HPR import hpsModel as HPS import utilFunctions as UF if __name__ == '__main__': (fs, x) = UF.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../sounds/speech-female.wav')) w = np.blackman(901) N = 1024 t = -80 nH = 30 minf0 = 100 maxf0 = 400 f0et = 2 maxFreq = 800 start = 0*fs end = x.size stocf = .2 y, yh, yr = HPR.hprModel(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et) y, yh, yst = HPS.hpsModel(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et, stocf) # wp.play(y, fs) # wp.play(yh, fs) # wp.play(yr, fs) # wp.play(yst, fs) UF.wavwrite(y,fs,'speech-female-synthesis.wav') UF.wavwrite(yh,fs,'speech-female-harmonic-component.wav') UF.wavwrite(yr,fs,'speech-female-residual-component.wav') UF.wavwrite(yst,fs,'speech-female-stochastic-component.wav')
import hprModel, hpsModel, hprModelSpectrogramPlot import smsWavplayer as wp if __name__ == '__main__': (fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../sounds/sax-phrase.wav')) w = np.blackman(801) N = 1024 t = -90 nH = 50 minf0 = 340 maxf0 = 700 f0et = 7 maxhd = 0.2 maxFreq = 2000 start = 0*fs end = x.size maxnpeaksTwm = 5 stocf = .2 y, yh, yr = hprModel.hprModel(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, maxnpeaksTwm) y, yh, yst = hpsModel.hpsModel(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf, maxnpeaksTwm) # hprModelSpectrogramPlot.hprModelPlot(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, maxFreq, maxnpeaksTwm) # wp.play(y, fs) # wp.play(yh, fs) # wp.play(yr, fs) # wp.play(yst, fs) wp.wavwrite(y,fs,'sax-phrase-total-synthesis.wav') wp.wavwrite(yh,fs,'sax-phrase-harmonic-component.wav') wp.wavwrite(yr,fs,'sax-phrase-residual-component.wav') wp.wavwrite(yst,fs,'sax-phrase-stochastic-component.wav')
import numpy as np import matplotlib.pyplot as plt import math import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../software/models/')) import hprModel as HPR import utilFunctions as UF if __name__ == '__main__': (fs, x) = UF.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../sounds/speech-male.wav')) w = np.blackman(1001) N = 1024 t = -90 nH = 100 minf0 = 60 maxf0 = 180 f0et = 3 y, yh, xr = HPR.hprModel(x, fs, w, N, t, nH, minf0, maxf0, f0et) # UF.play(y, fs) # UF.play(yh, fs) # UF.play(yr, fs) # UF.play(yst, fs) UF.wavwrite(y,fs,'speech-male-synthesis.wav') UF.wavwrite(yh,fs,'speech-male-harmonic-component.wav') UF.wavwrite(xr,fs,'speech-male-residual-component.wav')