def __init__(self, prop): openhri.VoiceSynthBase.__init__(self) self._conf = config() self._args = () self._sampling_rate = 0 self._frame_period = 0 self._all_pass = -1 self._postfiltering_coefficent = 0.0 self._speed_rate = 1.0 self._addtional_half_tone = 0.0 self._threshold = 0.5 self._gv_spectrum = 1.0 self._gv_log_f0 = 1.0 self._volume = 0.0 self._proc = None self._basedir = getHriDir() self._config = prop top_dir = self.bindParameter("openjtalk.top_dir", None, "") if top_dir : top_dir = re.sub('^%d0', self._basedir[:2], top_dir) self._conf.openjtalk_top(native_path(top_dir)) sox_dir = self.bindParameter("openjtalk.sox_dir", None, "") if sox_dir : sox_dir = re.sub('^%d0', self._basedir[:2], sox_dir) self._conf.sox_top(native_path(sox_dir)) male_dir = self.bindParameter("openjtalk.phonemodel_male_ja", None, "") if male_dir : self._conf._openjtalk_phonemodel_male_ja=make_dir female_dir = self.bindParameter("openjtalk.phonemodel_female_ja", None, "") if female_dir : self._conf._openjtalk_phonemodel_female_ja=female_dir # # get copyright infomationn self._copyrights = [] cmdarg = [ self._conf._openjtalk_bin ] self._proc = subprocess.Popen(cmdarg, stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: stdoutstr, stderrstr = self._proc.communicate() for l in stderrstr.decode('utf-8').replace('\r', '').split('\n\n'): if l.count('All rights reserved.') > 0: self._copyrights.append(l) except: print("Error in self._proc.communicate()") ################################## # read copyright self._copyrights.append(read_file_contents('hts_voice_copyright.txt')) self._copyrights.append(read_file_contents('mmdagent_mei_copyright.txt'))
def set_voxforge_de(self, configfile, drv=""): if 'julius.voxforge_de' in configfile : try: voxforge_de = configfile['julius.voxforge_de'] self._julius_voxforgedir_de = native_path(voxforge_de['base_dir']) if drv : self._julius_voxforgedir_de = re.sub('^\$d0', drv, self._julius_voxforgedir_de) self._julius_hmm_de = self.voxforge_de(native_path(voxforge_de['hmm'])) self._julius_hlist_de = self.voxforge_de(native_path(voxforge_de['hlist'])) except: print("=== Error in set_voxforge_de") return
def set_runkit_en(self, configfile, drv=""): if 'julius.runkit_en' in configfile : try: runkit_en = configfile['julius.runkit_en'] self._julius_runkitdir_en = native_path(runkit_en['base_dir']) if drv : self._julius_runkitdir_en = re.sub('^\$d0', drv, self._julius_runkitdir_en) self._julius_bin_en = self.runkit_en(native_path(runkit_en['executable'])) self._julius_dict_hmm_en = self.runkit_en(native_path(runkit_en['hmm'])) self._julius_dict_hlist_en = self.runkit_en(native_path(runkit_en['hlist'])) self._julius_dict_ngram_en = self.runkit_en(native_path(runkit_en['ngram'])) self._julius_dict_dict_en = self.runkit_en(native_path(runkit_en['dict'])) self._julius_dict_htkconf_en = self.runkit_en(native_path(runkit_en['htkconf'])) except: print("=== Error in set_runkit_en") return
def set_runkit_ja(self, configfile, drv=""): if 'julius.runkit_ja' in configfile : try: runkit_ja = configfile['julius.runkit_ja'] self._julius_runkitdir = native_path(runkit_ja['base_dir']) if drv : self._julius_runkitdir = re.sub('^\$d0', drv, self._julius_runkitdir) self._julius_bin = self.runkit(native_path(runkit_ja['executable'])) self._julius_hmm_ja = self.runkit(native_path(runkit_ja['hmm'])) self._julius_hlist_ja = self.runkit(native_path(runkit_ja['hlist'])) self._julius_ngram_ja = self.runkit(native_path(runkit_ja['ngram'])) self._julius_dict_ja = self.runkit(native_path(runkit_ja['dict'])) # # for dictation self._julius_bingram_ja = self.runkit(native_path(runkit_ja['bingram'])) self._julius_htkdic_ja = self.runkit(native_path(runkit_ja['htkdic'])) except: print("=== Error in set_runkit_ja") return