Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
mycroft.tts.TTS Class Reference
Inheritance diagram for mycroft.tts.TTS:
Inheritance graph
[legend]

Public Member Functions

def __del__ (self)
 
def __init__ (self, lang, config, validator, audio_ext='wav', phonetic_spelling=True, ssml_tags=None)
 
def begin_audio (self)
 
def clear_cache (self)
 
def end_audio (self)
 
def execute (self, sentence, ident=None)
 
def get_tts (self, sentence, wav_file)
 
def init (self, bus)
 
def load_phonemes (self, key)
 
def load_spellings (self)
 
def modify_tag (self, tag)
 
def save_phonemes (self, key, phonemes)
 
def validate_ssml (self, utterance)
 
def viseme (self, phonemes)
 

Static Public Member Functions

def remove_ssml (text)
 

Public Attributes

 audio_ext
 
 bus
 
 config
 
 enclosure
 
 filename
 
 lang
 
 phonetic_spelling
 
 playback
 
 queue
 
 spellings
 
 ssml_tags
 
 tts_name
 
 validator
 
 voice
 

Private Member Functions

def _preprocess_sentence (self, sentence)
 

Static Private Attributes

 __metaclass__ = ABCMeta
 

Detailed Description

TTS abstract class to be implemented by all TTS engines.

It aggregates the minimum required parameters and exposes
``execute(sentence)`` and ``validate_ssml(sentence)`` functions.

Args:
    lang (str):
    config (dict): Configuration for this specific tts engine
    validator (TTSValidator): Used to verify proper installation
    phonetic_spelling (bool): Whether to spell certain words phonetically
    ssml_tags (list): Supported ssml properties. Ex. ['speak', 'prosody']

Definition at line 144 of file scripts/mycroft/tts/__init__.py.

Constructor & Destructor Documentation

def mycroft.tts.TTS.__init__ (   self,
  lang,
  config,
  validator,
  audio_ext = 'wav',
  phonetic_spelling = True,
  ssml_tags = None 
)

Definition at line 161 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.__del__ (   self)

Definition at line 393 of file scripts/mycroft/tts/__init__.py.

Member Function Documentation

def mycroft.tts.TTS._preprocess_sentence (   self,
  sentence 
)
private
Default preprocessing is no preprocessing.

This method can be overridden to create chunks suitable to the
TTS engine in question.

Arguments:
    sentence (str): sentence to preprocess

Returns:
    list: list of sentence parts

Definition at line 279 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.begin_audio (   self)
Helper function for child classes to call in execute()

Definition at line 197 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.clear_cache (   self)
Remove all cached files. 

Definition at line 342 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.end_audio (   self)
    Helper function for child classes to call in execute().

    Sends the recognizer_loop:audio_output_end message, indicating
    that speaking is done for the moment. It also checks if cache
    directory needs cleaning to free up disk space.

Definition at line 202 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.execute (   self,
  sentence,
  ident = None 
)
    Convert sentence to speech, preprocessing out unsupported ssml

    The method caches results if possible using the hash of the
    sentence.

    Args:
sentence:   Sentence to be spoken
ident:      Id reference to current interaction

Definition at line 293 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.get_tts (   self,
  sentence,
  wav_file 
)
    Abstract method that a tts implementation needs to implement.
    Should get data from tts.

    Args:
sentence(str): Sentence to synthesize
wav_file(str): output file

    Returns:
tuple: (wav_file, phoneme)

Definition at line 230 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.init (   self,
  bus 
)
Performs intial setup of TTS object.

Arguments:
    bus:    Mycroft messagebus connection

Definition at line 219 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.load_phonemes (   self,
  key 
)
    Load phonemes from cache file.

    Args:
Key:    Key identifying phoneme cache

Definition at line 374 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.load_spellings (   self)
Load phonetic spellings of words as dictionary

Definition at line 182 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.modify_tag (   self,
  tag 
)
Override to modify each supported ssml tag

Definition at line 244 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.remove_ssml (   text)
static

Definition at line 249 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.save_phonemes (   self,
  key,
  phonemes 
)
    Cache phonemes

    Args:
key:        Hash key for the sentence
phonemes:   phoneme string to save

Definition at line 357 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.validate_ssml (   self,
  utterance 
)
    Check if engine supports ssml, if not remove all tags
    Remove unsupported / invalid tags

    Args:
utterance(str): Sentence to validate

    Returns: validated_sentence (str)

Definition at line 252 of file scripts/mycroft/tts/__init__.py.

def mycroft.tts.TTS.viseme (   self,
  phonemes 
)
    Create visemes from phonemes. Needs to be implemented for all
    tts backend

    Args:
phonemes(str): String with phoneme data

Definition at line 332 of file scripts/mycroft/tts/__init__.py.

Member Data Documentation

mycroft.tts.TTS.__metaclass__ = ABCMeta
staticprivate

Definition at line 158 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.audio_ext

Definition at line 168 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.bus

Definition at line 163 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.config

Definition at line 165 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.enclosure

Definition at line 173 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.filename

Definition at line 172 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.lang

Definition at line 164 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.phonetic_spelling

Definition at line 167 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.playback

Definition at line 176 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.queue

Definition at line 175 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.spellings

Definition at line 179 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.ssml_tags

Definition at line 169 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.tts_name

Definition at line 180 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.validator

Definition at line 166 of file scripts/mycroft/tts/__init__.py.

mycroft.tts.TTS.voice

Definition at line 171 of file scripts/mycroft/tts/__init__.py.


The documentation for this class was generated from the following file:


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:41