def test_tts_espeak(self): config = misc.load_config('.speechrc') tts = TTS(config.get('tts', 'host'), int(config.get('tts', 'port'))) tts.engine = 'espeak' first = True for v, word, ph in ESPEAK_TESTS: tts.locale = v tts.voice = v espeak_ph = tts.gen_ipa(word) self.assertEqual(espeak_ph, ph) wav = tts.synthesize(word) logging.debug('wav len: %d bytes.' % len(wav)) self.assertGreater(len(wav), 100) wav = tts.synthesize(ph, mode='ipa') logging.debug('wav len: %d bytes.' % len(wav)) self.assertGreater(len(wav), 100) if first: tts.say(word) first = False
def test_tts_mary(self): config = misc.load_config('.speechrc') tts = TTS(config.get('tts', 'host'), int(config.get('tts', 'port'))) # test mary tts.engine = 'mary' for l, voice, word, ph in MARY_TESTS: tts.locale = l tts.voice = voice mary_ph = tts.gen_ipa(word) self.assertEqual(mary_ph, ph) wav = tts.synthesize(word) logging.debug('wav len: %d bytes.' % len(wav)) self.assertGreater(len(wav), 100) wav = tts.synthesize(ph, mode='ipa') logging.debug('wav len: %d bytes.' % len(wav)) self.assertGreater(len(wav), 100)
def test_tts_pico(self): config = misc.load_config('.speechrc') tts = TTS(config.get('tts', 'host'), int(config.get('tts', 'port'))) tts.engine = 'pico' for v, word in PICO_TESTS: tts.locale = v tts.voice = v wav = tts.synthesize(word) logging.debug('wav len: %d bytes.' % len(wav)) self.assertGreater(len(wav), 100) tts.say(word)
lex_cur_token = lex_cur_token % len(lex_tokens) lex_set_token(lex_tokens[lex_cur_token]) # generate de-mary elif c == ord('g'): lex_entry['ipa'] = lex_gen_ipa('de', 'mary', 'bits3', True) # generate de-espeak elif c == ord('h'): lex_entry['ipa'] = lex_gen_ipa('de', 'espeak', 'de', True) # generate en-mary elif c == ord('l'): tts.locale = 'en-US' tts.engine = 'mary' tts.voice = 'cmu-rms-hsmm' ipas = tts.gen_ipa(lex_base) tts.say_ipa(ipas, async=True) lex_entry['ipa'] = ipas # generate fr-mary elif c == ord('k'): tts.locale = 'fr' tts.engine = 'mary' tts.voice = 'upmc-pierre-hsmm' ipas = tts.gen_ipa(lex_base)
if len(lex_entry['ipa']) == 0: continue ipas = lex_entry['ipa'] say_ipa('de', 'mary', 'dfki-pavoque-neutral-hsmm', ipas) # speak fr mary hsmm elif c == ord('i'): if len(lex_entry['ipa']) == 0: continue ipas = lex_entry['ipa'] tts.locale = 'fr' tts.engine = 'mary' tts.voice = 'upmc-pierre-hsmm' say_ipa('fr', 'mary', 'upmc-pierre-hsmm', ipas) # speak en mary hsmm elif c == ord('u'): ipas = lex_entry['ipa'] say_ipa('en-US', 'mary', 'cmu-rms-hsmm', ipas) # edit token elif c == ord('t'):