Example #1
0
    def test_synthesise_en(self):
        text = 'Hello, this is alex, the call is recorded, how may I help You?'
        cfg = {
            'Audio': {
                'sample_rate': 16000,
            },
            'TTS': {
                'type': 'VoiceRss',
                'VoiceRss': {
                    'language':
                    'en-us',
                    'preprocessing':
                    as_project_path("resources/tts/prep_voicerss_en.cfg"),
                    'tempo':
                    1.0,
                    'api_key':
                    'ea29b823c83a426bbfe99f4cbce109f6'
                }
            }
        }
        wav_path = '/tmp/voice_rss_tts.wav'

        tts = VoiceRssTTS(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(5.292, wav_length)
Example #2
0
    def test_synthesise_en(self):
        text = 'Hello, this is alex, the call is recorded, how may I help You?'
        cfg = {
            'Audio': {
                'sample_rate': 16000,
            },
            'TTS': {
                'type': 'VoiceRss',
                'VoiceRss': {
                    'language': 'en-us',
                    'preprocessing': as_project_path("resources/tts/prep_voicerss_en.cfg"),
                    'tempo': 1.0,
                    'api_key': 'ea29b823c83a426bbfe99f4cbce109f6'
                }
            }
        }
        wav_path = '/tmp/voice_rss_tts.wav'

        tts = VoiceRssTTS(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(5.292, wav_length)
    print "Synthesize text:", text
    print "Voice:          ", voice
    print

    c = {
        "TTS": {
            "debug": False,
            "type": "VoiceRss",
            "VoiceRss": {
                "language": "en-us",
                "preprocessing": as_project_path("resources/tts/prep_voicerss_en.cfg"),
                "tempo": 1.0,
                "api_key": "ea29b823c83a426bbfe99f4cbce109f6",
            },
        }
    }
    cfg = Config.load_configs(log=False)
    cfg.update(c)

    tts = VoiceRssTTS(cfg)

    print "calling TTS"
    wav = tts.synthesize(text)

    print "saving the TTS audio in ./tmp/voice_rss_tts.wav"
    audio.save_wav(cfg, "./tmp/voice_rss_tts.wav", wav)

    print "playing audio"
    audio.play(cfg, wav)
Example #4
0
    c = {
        'TTS': {
            'debug': False,
            'type': 'VoiceRss',
            'VoiceRss': {
                'language':
                'en-us',
                'preprocessing':
                as_project_path("resources/tts/prep_voicerss_en.cfg"),
                'tempo':
                1.0,
                'api_key':
                'ea29b823c83a426bbfe99f4cbce109f6'
            }
        }
    }
    cfg = Config.load_configs(log=False)
    cfg.update(c)

    tts = VoiceRssTTS(cfg)

    print 'calling TTS'
    wav = tts.synthesize(text)

    print 'saving the TTS audio in ./tmp/voice_rss_tts.wav'
    audio.save_wav(cfg, './tmp/voice_rss_tts.wav', wav)

    print 'playing audio'
    audio.play(cfg, wav)