def test_synthesise_en(self): text = 'Hello, this is Alex, How may i help You?' cfg = { 'Audio': { 'sample_rate': 16000, }, 'TTS': { 'type': 'Google', 'Google': { 'debug': True, 'language': 'en-us', 'preprocessing': as_project_path("resources/tts/prep_google_en.cfg"), 'tempo': 1.0, }, }, } wav_path = '/tmp/google.wav' tts = GoogleTTS(cfg) wav = tts.synthesize(text) audio.save_wav(cfg, wav_path, wav) file = wave.open(wav_path) wav_length = float(file.getnframes()) / file.getframerate() self.assertGreaterEqual(3.5, wav_length) self.assertLessEqual(2.5, wav_length)
def test_synthesise_en(self): text = 'Hello, this is Alex, How may i help You?' cfg = { 'Audio': { 'sample_rate': 16000, }, 'TTS': { 'type': 'Google', 'Google': { 'debug': True, 'language': 'en-us', 'preprocessing': as_project_path("resources/tts/prep_google_en.cfg"), 'tempo': 1.0, }, }, } wav_path = '/tmp/google.wav' tts = GoogleTTS(cfg) wav = tts.synthesize(text) audio.save_wav(cfg, wav_path, wav) file = wave.open(wav_path) wav_length = float(file.getnframes()) / file.getframerate() self.assertEquals(3.06, wav_length)
print "Language: ", language print c = { 'TTS': { 'Google': { 'debug': False, 'preprocessing': as_project_path("resources/tts/prep_speechtech_en.cfg"), 'tempo': 1.0, 'language': language } } } cfg = Config.load_configs(log=False) cfg.update(c) tts = GoogleTTS(cfg) print 'calling TTS' wav = tts.synthesize(text) print 'saving the TTS audio in ./tmp/google_tts.wav' audio.save_wav(cfg, './tmp/google_tts.wav', wav) print 'playing audio' audio.play(cfg, wav)
print text = 'Hello. Thank you for calling.' language = 'en' print "Synthesize text:", text print "Language: ", language print c = { 'TTS': { 'Google': { 'debug': False, 'language': language } } } cfg = Config.load_configs(log=False) cfg.update(c) tts = GoogleTTS(cfg) print 'calling TTS' wav = tts.synthesize(text) print 'saving the TTS audio in ./tmp/google_tts.wav' audio.save_wav(cfg, './tmp/google_tts.wav', wav) print 'playing audio' audio.play(cfg, wav)