Esempio n. 1
0
    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)
Esempio n. 2
0
    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
Esempio n. 3
0
    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)