Esempio n. 1
0
    def is_available(cls):
        if (super(cls, cls).is_available() and
           diagnose.check_executable('text2wave') and
           diagnose.check_executable('festival')):

            logger = logging.getLogger(__name__)
            cmd = ['festival', '--pipe']
            with tempfile.SpooledTemporaryFile() as out_f:
                with tempfile.SpooledTemporaryFile() as in_f:
                    logger.debug('Executing %s', ' '.join([pipes.quote(arg)
                                                           for arg in cmd]))
                    subprocess.call(cmd, stdin=in_f, stdout=out_f,
                                    stderr=out_f)
                    out_f.seek(0)
                    output = out_f.read().strip()
                    if output:
                        logger.debug("Output was: '%s'", output)
                    return ('No default voice found' not in output)
        return False
Esempio n. 2
0
 def __new__(cls, fst_model=None, *args, **kwargs):
     if not diagnose.check_executable("phonetisaurus-g2p"):
         raise OSError(
             "Can't find command 'phonetisaurus-g2p'! Please "
             + "check if Phonetisaurus is installed and in your "
             + "$PATH."
         )
     if fst_model is None or not os.access(fst_model, os.R_OK):
         raise OSError(("FST model '%r' does not exist! Can't create " + "instance.") % fst_model)
     inst = object.__new__(cls, fst_model, *args, **kwargs)
     return inst
Esempio n. 3
0
 def __new__(cls, fst_model=None, *args, **kwargs):
     if not diagnose.check_executable('phonetisaurus-g2p'):
         raise OSError("Can't find command 'phonetisaurus-g2p'! Please " +
                       "check if Phonetisaurus is installed and in your " +
                       "$PATH.")
     if fst_model is None or not os.access(fst_model, os.R_OK):
         raise OSError(
             ("FST model '%r' does not exist! Can't create " + "instance.")
             % fst_model)
     inst = object.__new__(cls, *args, **kwargs)
     return inst
Esempio n. 4
0
import collections
import logging
import pipes
import re
import subprocess
import tempfile
from client import diagnose
from client import plugin

if not diagnose.check_executable('espeak'):
    raise ImportError("espeak executable not found!")


RE_PATTERN = re.compile(r'(?P<pty>\d+)\s+' +
                        r'(?P<lang>[a-z-]+)\s+' +
                        r'(?P<gender>[MF-])\s+' +
                        r'(?P<name>[\w-]+)\s+\S+\s+' +
                        r'(?P<other>(?:\([a-z-]+\s+\d+\))*)')
RE_OTHER = re.compile(r'\((?P<lang>[a-z-]+)\s+(?P<pty>\d+)\)')

Voice = collections.namedtuple(
    'Voice', ['name', 'gender', 'priority', 'language'])


class EspeakTTSPlugin(plugin.TTSPlugin):
    """
    Uses the eSpeak speech synthesizer included in the Jasper disk image
    Requires espeak to be available
    """

    def __init__(self, *args, **kwargs):
Esempio n. 5
0
 def is_available(cls):
     return (super(cls, cls).is_available() and
             diagnose.check_executable('pico2wave'))
Esempio n. 6
0
 def is_available(cls):
     return (platform.system().lower() == 'darwin' and
             diagnose.check_executable('say') and
             diagnose.check_executable('afplay'))
Esempio n. 7
0
 def is_available(cls):
     return (super(cls, cls).is_available() and
             diagnose.check_executable('flite') and
             len(cls.get_voices()) > 0)
Esempio n. 8
0
 def is_available(cls):
     return (super(cls, cls).is_available() and
             diagnose.check_executable('espeak'))
Esempio n. 9
0
import collections
import logging
import pipes
import re
import subprocess
import tempfile
from client import diagnose
from client import plugin

if not diagnose.check_executable('espeak'):
    raise ImportError("espeak executable not found!")

RE_PATTERN = re.compile(r'(?P<pty>\d+)\s+' + r'(?P<lang>[a-z-]+)\s+' +
                        r'(?P<gender>[MF-])\s+' +
                        r'(?P<name>[\w-]+)\s+\S+\s+' +
                        r'(?P<other>(?:\([a-z-]+\s+\d+\))*)')
RE_OTHER = re.compile(r'\((?P<lang>[a-z-]+)\s+(?P<pty>\d+)\)')

Voice = collections.namedtuple('Voice',
                               ['name', 'gender', 'priority', 'language'])


class EspeakTTSPlugin(plugin.TTSPlugin):
    """
    Uses the eSpeak speech synthesizer included in the Jasper disk image
    Requires espeak to be available
    """
    def __init__(self, *args, **kwargs):
        plugin.TTSPlugin.__init__(self, *args, **kwargs)

        self._logger = logging.getLogger(__name__)
Esempio n. 10
0
 def is_available(cls):
     return diagnose.check_executable('julius')
Esempio n. 11
0
 def is_available(cls):
     return diagnose.check_executable('aplay')