Пример #1
0
    def synthesize(self, text):
        """ Synthesize the text and returns it in a string with audio in default format and sample rate. """

        wav = b""
        
        try:
            if text:
                text = self.preprocessing.process(text)

                mp3 = self.get_tts_mp3(self.cfg['TTS']['SpeechTech']['voice'], text)
                wav = audio.convert_mp3_to_wav(self.cfg, mp3)
                wav = audio.change_tempo(self.cfg, self.cfg['TTS']['SpeechTech']['tempo'], wav)

#               if self.cfg['TTS']['debug']:
#                   m = "TTS cache hits %d and misses %d " % (self.get_tts_mp3.hits, self.get_tts_mp3.misses)
#                   self.cfg['Logging']['system_logger'].debug(m)
                return wav
            else:
                return b""
                
        except TTSException as e:
            m = unicode(e) + " Text: %s" % text
            self.cfg['Logging']['system_logger'].exception(m)
            return b""

        return wav
Пример #2
0
    def synthesize(self, text):
        """
        Synthesize the text and returns it in a string with audio in default
        format and sample rate.
        """
        try:
            if text:
                text = self.preprocessing.process(text)

                mp3 = self.get_tts_mp3(
                    self.cfg['TTS']['Google']['language'], text,
                    self.cfg['TTS']['Google'].get('tempo', 1.0))
                wav = audio.convert_mp3_to_wav(self.cfg, mp3)
                wav = audio.change_tempo(self.cfg,
                                         self.cfg['TTS']['Google']['tempo'],
                                         wav)

                return wav
            else:
                return b""

        except TTSException as e:
            m = unicode(e) + " Text: %s" % text
            self.cfg['Logging']['system_logger'].exception(m)
            return b""
Пример #3
0
Файл: google.py Проект: AoJ/alex
    def synthesize(self, text):
        """
        Synthesize the text and returns it in a string with audio in default
        format and sample rate.
        """
        wav = b""

        try:
            if text:
                text = self.preprocessing.process(text)

                mp3 = self.get_tts_mp3(self.cfg['TTS']['Google']['language'],
                                       text,
                                       self.cfg['TTS']['Google'].get('tempo', 1.0))
                wav = audio.convert_mp3_to_wav(self.cfg, mp3)
                wav = audio.change_tempo(self.cfg, self.cfg['TTS']['Google']['tempo'], wav)

                return wav
            else:
                return b""

        except TTSException as e:
            m = unicode(e) + " Text: %s" % text
            self.cfg['Logging']['system_logger'].exception(m)
            return b""

        return wav
Пример #4
0
    def synthesize(self, text):
        """ Synthesize the text and returns it in a string with audio in default format and sample rate. """

        wav = b""

        try:
            if text:
                text = self.preprocessing.process(text)

                mp3 = self.get_tts_mp3(self.cfg['TTS']['SpeechTech']['voice'],
                                       text)
                wav = audio.convert_mp3_to_wav(self.cfg, mp3)
                wav = audio.change_tempo(
                    self.cfg, self.cfg['TTS']['SpeechTech']['tempo'], wav)

                #               if self.cfg['TTS']['debug']:
                #                   m = "TTS cache hits %d and misses %d " % (self.get_tts_mp3.hits, self.get_tts_mp3.misses)
                #                   self.cfg['Logging']['system_logger'].debug(m)
                return wav
            else:
                return b""

        except TTSException as e:
            m = unicode(e) + " Text: %s" % text
            self.cfg['Logging']['system_logger'].exception(m)
            return b""

        return wav
Пример #5
0
Файл: flite.py Проект: AoJ/alex
    def synthesize(self, text):
        """\
        Synthesizes the text and returns it as a string with audio in default
        format and sample rate.

        """

        try:
            text = self.preprocessing.process(text)
            
            wav = self.get_tts_wav(self.cfg['TTS']['Flite']['voice'], text)
            wav = audio.change_tempo(self.cfg, self.cfg['TTS']['Flite']['tempo'], wav)
        except TTSException:
            m = e + "Text: %" % text
            self.cfg['Logging']['system_logger'].exception(m)
            return b""

        return wav
Пример #6
0
    def synthesize(self, text):
        """\
        Synthesizes the text and returns it as a string with audio in default
        format and sample rate.

        """

        try:
            text = self.preprocessing.process(text)

            wav = self.get_tts_wav(self.cfg['TTS']['Flite']['voice'], text)
            wav = audio.change_tempo(self.cfg,
                                     self.cfg['TTS']['Flite']['tempo'], wav)
        except TTSException:
            m = e + "Text: %" % text
            self.cfg['Logging']['system_logger'].exception(m)
            return b""

        return wav