Ejemplo n.º 1
0
class VoiceRssTTS(TTSInterface):
    """Uses The VoiceRss TTS service to synthesize sentences in a
    specific language, e.g. en-us.

    The main function synthesize returns a string which contain a RIFF
    wave file audio of the synthesized text."""

    def __init__(self, cfg):
        """Intitialize: just remember the configuration."""
        self.cfg = cfg
        super(VoiceRssTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(self.cfg, self.cfg['TTS']['VoiceRss']['preprocessing'])

    @cache.persistent_cache(True, 'VoiceRssTTS.get_tts_mp3.')
    def get_tts_mp3(self, language, text):
        """Access the VoiceRss TTS service and get synthesized audio
        for a text.
        Returns a string with a WAV stream."""
        baseurl = "http://api.voicerss.org"
        values = {'src': text.encode('utf8'),
                  'hl': language,
                  'c': 'MP3',
                  'f': '16khz_16bit_mono',
                  'key': self.cfg['TTS']['VoiceRss']['api_key']}
        data = urllib.urlencode(values)
        request = urllib2.Request(baseurl, data)
        request.add_header("User-Agent", "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11")
        try:
            mp3response = urllib2.urlopen(request)

            return mp3response.read()
        except (urllib2.HTTPError, urllib2.URLError):
            raise TTSException("SpeechTech TTS error.")

    def synthesize(self, text):
        """Synthesize the text and return 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']['VoiceRss']['language'], text)
                wav = audio.convert_mp3_to_wav(self.cfg, mp3)
                wav = audio.change_tempo(self.cfg, self.cfg['TTS']['VoiceRss']['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
Ejemplo n.º 2
0
class FliteTTS(TTSInterface):
    """Uses Flite TTS to synthesize sentences in English.

    The main function `synthesize' returns a string which contains a RIFF wave
    file audio of the synthesized text.

    """
    def __init__(self, cfg):
        super(FliteTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(
            self.cfg, self.cfg['TTS']['Flite']['preprocessing'])

    @cache.persistent_cache(True, 'FliteTTS.get_tts_wav.')
    def get_tts_wav(self, voice, text):
        """Runs flite from the command line and gets the synthesized audio.
        Note that the returned audio is in the re-sampled PCM audio format.

        """

        handle, wav_file_name = mkstemp('TmpSpeechFile.wav')

        if voice not in ['awb', 'rms', 'slt', 'kal', 'awb_time', 'kal16']:
            voice = 'awb'

        try:
            subprocess.call("flite -voice %s -t \"%s\" -o %s 2> /dev/null" %
                            (voice, text, wav_file_name),
                            shell=True)
            wav = audio.load_wav(self.cfg, wav_file_name)
        except:
            raise TTSException("No data synthesized.")

        return wav

    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
Ejemplo n.º 3
0
Archivo: flite.py Proyecto: AoJ/alex
class FliteTTS(TTSInterface):
    """Uses Flite TTS to synthesize sentences in English.

    The main function `synthesize' returns a string which contains a RIFF wave
    file audio of the synthesized text.

    """

    def __init__(self, cfg):
        super(FliteTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(self.cfg, self.cfg['TTS']['Flite']['preprocessing'])

    @cache.persistent_cache(True, 'FliteTTS.get_tts_wav.')
    def get_tts_wav(self, voice, text):
        """Runs flite from the command line and gets the synthesized audio.
        Note that the returned audio is in the re-sampled PCM audio format.

        """

        handle, wav_file_name = mkstemp('TmpSpeechFile.wav')

        if voice not in ['awb', 'rms', 'slt', 'kal', 'awb_time', 'kal16']:
            voice = 'awb'

        try:
            subprocess.call("flite -voice %s -t \"%s\" -o %s 2> /dev/null" %
                            (voice, text, wav_file_name), shell=True)
            wav = audio.load_wav(self.cfg, wav_file_name)
        except:
            raise TTSException("No data synthesized.")

        return wav

    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
Ejemplo n.º 4
0
 def __init__(self, cfg):
     super(SpeechtechTTS, self).__init__(cfg)
     self.preprocessing = TTSPreprocessing(self.cfg, self.cfg['TTS']['SpeechTech']['preprocessing'])
Ejemplo n.º 5
0
class SpeechtechTTS(TTSInterface):
    """ Uses SpeechTech TTS service to synthesize sentences in a specific language, e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave file audio of the synthesized text.

    """

    def __init__(self, cfg):
        super(SpeechtechTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(self.cfg, self.cfg['TTS']['SpeechTech']['preprocessing'])

    @cache.lru_cache(10000)
    @cache.persistent_cache(True, 'SpeechtechTTS.get_tts_mp3.')
    def get_tts_mp3(self, voice, text):
        """ Access SpeechTech TTS service and get synthesized audio.

        Returns a string with wav in it.

        """

        try:
            TIMEOUT = 30
            LOGIN = self.cfg['TTS']['SpeechTech']['login']
            PASSWD = self.cfg['TTS']['SpeechTech']['password']
            REALM = 'TTS-Server'
            ROOT_URI = 'http://tts2.speechtech.cz'
            URI = '%s/add_to_queue' % ROOT_URI

            if hasattr(socket, 'setdefaulttimeout'):
                socket.setdefaulttimeout(TIMEOUT)

            # Create an OpenerDirector with support for Basic HTTP Authentication...
            auth_handler = urllib2.HTTPDigestAuthHandler()
            auth_handler.add_password(realm=REALM,
                                      uri=URI,
                                      user=LOGIN,
                                      passwd=PASSWD)
            opener = urllib2.build_opener(auth_handler)
            urllib2.install_opener(opener)

            params = urllib.urlencode([('text', text.encode('utf8')), ('engine', voice.encode('utf8'))])
            task_id = urllib2.urlopen('%s/add_to_queue' % ROOT_URI, params).read().strip()

            uri = None
            i = 20
            while i:
                params = urllib.urlencode([('task_id', task_id)])
                resp = urllib2.urlopen('%s/query_status' % ROOT_URI, params).read().splitlines()
                code = int(resp[0])
                #print 'Status is', code
                if code == 3:
                    uri = resp[1]
                    #print 'Result available at', uri
                    break
                time.sleep(0.2)

                i -= 1

            if uri:
                request = urllib2.Request(uri)
                request.add_header("User-Agent", "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11")
                mp3response = urllib2.urlopen(request)

                return mp3response.read()
        except (urllib2.HTTPError, urllib2.URLError):
            raise TTSException("SpeechTech TTS error.")

        raise TTSException("Time out: No data synthesized.")

    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
Ejemplo n.º 6
0
 def __init__(self, cfg):
     super(FliteTTS, self).__init__(cfg)
     self.preprocessing = TTSPreprocessing(
         self.cfg, self.cfg['TTS']['Flite']['preprocessing'])
Ejemplo n.º 7
0
class GoogleTTS(TTSInterface):
    """
    Uses Google TTS service to synthesize sentences in a specific language,
    e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave
    file audio of the synthesized text.

    """
    def __init__(self, cfg):
        super(GoogleTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(
            self.cfg, self.cfg['TTS']['Google']['preprocessing'])

    @cache.persistent_cache(True, 'GoogleTTS.get_tts_mp3.')
    def get_tts_mp3(self, language, text, rate=1.0):
        """
        Access Google TTS service and get synthesized audio.
        Note that the returned audio is in the MP3 format.

        Returns a string with MP3 in it.

        """

        baseurl = "http://translate.google.com/translate_tts"
        values = {'q': text.encode('utf8'), 'tl': language, 'rate': rate}
        if self.cfg['TTS']['Google']['debug']:
            print values

        data = urllib.urlencode(values)
        request = urllib2.Request(baseurl, data)
        request.add_header(
            "User-Agent",
            "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.163 Safari/535.19"
        )
        request.add_header(
            'Referer', 'http://www.gstatic.com/translate/sound_player2.swf')

        mp3response = urllib2.urlopen(request)

        return mp3response.read()

    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""
Ejemplo n.º 8
0
Archivo: google.py Proyecto: AoJ/alex
 def __init__(self, cfg):
     super(GoogleTTS, self).__init__(cfg)
     self.preprocessing = TTSPreprocessing(
         self.cfg, self.cfg['TTS']['Google']['preprocessing'])
Ejemplo n.º 9
0
Archivo: google.py Proyecto: AoJ/alex
class GoogleTTS(TTSInterface):
    """
    Uses Google TTS service to synthesize sentences in a specific language,
    e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave
    file audio of the synthesized text.

    """

    def __init__(self, cfg):
        super(GoogleTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(
            self.cfg, self.cfg['TTS']['Google']['preprocessing'])

    @cache.persistent_cache(True, 'GoogleTTS.get_tts_mp3.')
    def get_tts_mp3(self, language, text, rate=1.0):
        """
        Access Google TTS service and get synthesized audio.
        Note that the returned audio is in the MP3 format.

        Returns a string with MP3 in it.

        """

        baseurl = "http://translate.google.com/translate_tts"
        values = {'q': text.encode('utf8'), 'tl': language, 'rate': rate}
        if self.cfg['ASR']['Google']['debug']:
            print values

        data = urllib.urlencode(values)
        request = urllib2.Request(baseurl, data)
        request.add_header("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.163 Safari/535.19")
        request.add_header('Referer', 'http://www.gstatic.com/translate/sound_player2.swf')

        mp3response = urllib2.urlopen(request)

        return mp3response.read()

    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
Ejemplo n.º 10
0
 def __init__(self, cfg):
     super(SpeechtechTTS, self).__init__(cfg)
     self.preprocessing = TTSPreprocessing(
         self.cfg, self.cfg['TTS']['SpeechTech']['preprocessing'])
Ejemplo n.º 11
0
class SpeechtechTTS(TTSInterface):
    """ Uses SpeechTech TTS service to synthesize sentences in a specific language, e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave file audio of the synthesized text.

    """
    def __init__(self, cfg):
        super(SpeechtechTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(
            self.cfg, self.cfg['TTS']['SpeechTech']['preprocessing'])

    @cache.lru_cache(10000)
    @cache.persistent_cache(True, 'SpeechtechTTS.get_tts_mp3.')
    def get_tts_mp3(self, voice, text):
        """ Access SpeechTech TTS service and get synthesized audio.

        Returns a string with wav in it.

        """

        try:
            TIMEOUT = 30
            LOGIN = self.cfg['TTS']['SpeechTech']['login']
            PASSWD = self.cfg['TTS']['SpeechTech']['password']
            REALM = 'TTS-Server'
            ROOT_URI = 'http://tts2.speechtech.cz'
            URI = '%s/add_to_queue' % ROOT_URI

            if hasattr(socket, 'setdefaulttimeout'):
                socket.setdefaulttimeout(TIMEOUT)

            # Create an OpenerDirector with support for Basic HTTP Authentication...
            auth_handler = urllib2.HTTPDigestAuthHandler()
            auth_handler.add_password(realm=REALM,
                                      uri=URI,
                                      user=LOGIN,
                                      passwd=PASSWD)
            opener = urllib2.build_opener(auth_handler)
            urllib2.install_opener(opener)

            params = urllib.urlencode([('text', text.encode('utf8')),
                                       ('engine', voice.encode('utf8'))])
            task_id = urllib2.urlopen('%s/add_to_queue' % ROOT_URI,
                                      params).read().strip()

            uri = None
            i = 20
            while i:
                params = urllib.urlencode([('task_id', task_id)])
                resp = urllib2.urlopen('%s/query_status' % ROOT_URI,
                                       params).read().splitlines()
                code = int(resp[0])
                #print 'Status is', code
                if code == 3:
                    uri = resp[1]
                    #print 'Result available at', uri
                    break
                time.sleep(0.2)

                i -= 1

            if uri:
                request = urllib2.Request(uri)
                request.add_header(
                    "User-Agent",
                    "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"
                )
                mp3response = urllib2.urlopen(request)

                return mp3response.read()
        except (urllib2.HTTPError, urllib2.URLError):
            raise TTSException("SpeechTech TTS error.")

        raise TTSException("Time out: No data synthesized.")

    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
Ejemplo n.º 12
0
class GoogleTTS(TTSInterface):
    """
    Uses Google TTS service to synthesize sentences in a specific language,
    e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave
    file audio of the synthesized text.

    """
    def __init__(self, cfg):
        super(GoogleTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(
            self.cfg, self.cfg['TTS']['Google']['preprocessing'])

    @cache.persistent_cache(True, 'GoogleTTS.get_tts_mp3.')
    def get_tts_mp3(self, language, text, rate=1.0):
        """
        Access Google TTS service and get synthesized audio.
        Note that the returned audio is in the MP3 format.

        Returns a string with MP3 in it.

        """

        baseurl = "http://translate.google.com/translate_tts"
        values = {
            'q': text.encode('utf8'),
            'tl': language,
            'rate': rate,
            'ie': 'UTF-8',
            'total': 1,
            'idx': 0,
            'client': 't'
        }
        if self.cfg['TTS']['Google']['debug']:
            print values

        data = urllib.urlencode(values)
        # not using the "data" parameter of urllib2.Request => GET method will be used
        request = urllib2.Request(baseurl + '?' + str(data))
        request.add_header(
            "User-Agent",
            "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0"
        )
        request.add_header("Accept", "*/*")

        mp3response = urllib2.urlopen(request)

        return mp3response.read()

    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""
Ejemplo n.º 13
0
class SpeechtechTTS(TTSInterface):
    """ Uses SpeechTech TTS service to synthesize sentences in a specific language, e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave file audio of the synthesized text.

    """

    def __init__(self, cfg):
        super(SpeechtechTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(self.cfg, self.cfg['TTS']['SpeechTech']['preprocessing'])

    @cache.lru_cache(10000)
    @cache.persistent_cache(True, 'SpeechtechTTS.get_tts_mp3.')
    def get_tts_mp3(self, voice, text):
        """ Access SpeechTech TTS service and get synthesized audio.

        Returns a string with wav in it.

        """

        try:
            TIMEOUT = 30
            LOGIN = self.cfg['TTS']['SpeechTech']['login']
            PASSWD = self.cfg['TTS']['SpeechTech']['password']
            ROOT_URI = 'http://services.speechtech.cz/tts/v3'

            if hasattr(socket, 'setdefaulttimeout'):
                socket.setdefaulttimeout(TIMEOUT)

            mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
            mgr.add_password(None, ROOT_URI, LOGIN, PASSWD)
            auth = urllib2.HTTPDigestAuthHandler(mgr)
            opener = urllib2.build_opener(auth)

            mp3data = opener.open(ROOT_URI+'/synth', data=json.dumps({'text': text, 'engine': voice})).read()
            return mp3data

        except (urllib2.HTTPError, urllib2.URLError) as e:
            raise TTSException("SpeechTech TTS error: " + unicode(e))

        raise TTSException("Time out: No data synthesized.")

    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
Ejemplo n.º 14
0
class GoogleTTS(TTSInterface):
    """
    Uses Google TTS service to synthesize sentences in a specific language,
    e.g. en, cs.

    The main function synthesize returns a string which contain a RIFF wave
    file audio of the synthesized text.

    """

    def __init__(self, cfg):
        super(GoogleTTS, self).__init__(cfg)
        self.preprocessing = TTSPreprocessing(
            self.cfg, self.cfg['TTS']['Google']['preprocessing'])

    @cache.persistent_cache(True, 'GoogleTTS.get_tts_mp3.')
    def get_tts_mp3(self, language, text, rate=1.0):
        """
        Access Google TTS service and get synthesized audio.
        Note that the returned audio is in the MP3 format.

        Returns a string with MP3 in it.

        """

        baseurl = "http://translate.google.com/translate_tts"
        values = {'q': text.encode('utf8'),
                  'tl': language,
                  'rate': rate,
                  'ie': 'UTF-8',
                  'total': 1,
                  'idx': 0,
                  'client': 't'}
        if self.cfg['TTS']['Google']['debug']:
            print values

        data = urllib.urlencode(values)
        # not using the "data" parameter of urllib2.Request => GET method will be used
        request = urllib2.Request(baseurl + '?' + str(data))
        request.add_header("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0")
        request.add_header("Accept", "*/*")

        mp3response = urllib2.urlopen(request)

        return mp3response.read()

    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""
Ejemplo n.º 15
0
 def __init__(self, cfg):
     """Intitialize: just remember the configuration."""
     self.cfg = cfg
     super(VoiceRssTTS, self).__init__(cfg)
     self.preprocessing = TTSPreprocessing(self.cfg, self.cfg['TTS']['VoiceRss']['preprocessing'])