Usage¶
talkey module:¶
-
talkey.enumerate_engines()¶ Returns list of engine SLUGs in order of preference
-
talkey.create_engine(engine, options=None, defaults=None)¶ Creates an instance of an engine. There is a two-stage instantiation process with engines.
options:The keyword options to instantiate the engine class
defaults:The default configuration for the engine (options often depends on instantiated TTS engine)
-
class
talkey.Talkey(preferred_languages=None, preferred_factor=80.0, engine_preference=None, **config)¶ Manages engines and allows multi-lingual say()
preferred_languages- A list of languages that are weighted in preference. This is a weighting to assist the detection of language by classify().
preferred_factor- The weighting factor to prefer the
preferred_languageslist. Higher number skews towards preference. engine_preference- Specify preferred engines in order of preference.
**configEngine-specfic configuration, e.g.:
# Key is the engine SLUG, in this case ``espeak`` espeak={ # Specify the engine options: 'options': { 'enabled': True, }, # Specify some default voice options 'defaults': { 'words_per_minute': 150, 'variant': 'f4', }, # Here you specify language-specific voice options # e.g. for english we prefer the mbrola en1 voice 'languages': { 'en': { 'voice': 'english-mb-en1', 'words_per_minute': 130 }, } }
-
classify(txt)¶ Classifies text by language. Uses preferred_languages weighting.
-
get_engine_for_lang(lang)¶ Determines the preferred engine/voice for a language.
-
say(txt, lang=None)¶ Says the text.
if
langisNone, then usesclassify()to detect language.
-
exception
talkey.TTSError(error, valid_set=None)¶ The exception that Talkey will throw if any error occurs.
Engine options:¶
espeak:¶
-
class
talkey.engines.EspeakTTS(**_options)¶ Uses the eSpeak speech synthesizer.
Requires
espeakand optionallymbrolato be available.Initialization options:
enabledIs enabled?
type: bool default: True espeakeSpeak executable path
type: exec default: [‘espeak’, ‘c:\Program Files\eSpeak\command_line\espeak.exe’] mbrolambrola executable path
type: exec default: mbrola mbrola_voicesmbrola voices path
type: str default: /usr/share/mbrola passable_onlyOnly allow languages of passable quality, as per http://espeak.sourceforge.net/languages.html
type: bool default: True
festival:¶
-
class
talkey.engines.FestivalTTS(**_options)¶ Uses the festival speech synthesizer.
Requires
festivalto be available.Initialization options:
enabledIs enabled?
type: bool default: True festivalFestival executable path
type: str default: festival
flite:¶
-
class
talkey.engines.FliteTTS(**_options)¶ Uses the flite speech synthesizer.
Requires
fliteto be available.Initialization options:
enabledIs enabled?
type: bool default: True fliteFLite executable path
type: str default: flite
pico:¶
-
class
talkey.engines.PicoTTS(**_options)¶ Uses the svox-pico-tts speech synthesizer.
Requires
pico2waveto be available.Initialization options:
enabledIs enabled?
type: bool default: True pico2wavepico2wave executable path
type: str default: pico2wave
mary:¶
-
class
talkey.engines.MaryTTS(**_options)¶ Uses the MARY Text-to-Speech System (MaryTTS) MaryTTS is an open-source, multilingual Text-to-Speech Synthesis platform written in Java. Please specify your own server instead of using the demonstration server (http://mary.dfki.de:59125/) to save bandwidth and to protect your privacy.
Initialization options:
enabledIs enabled?
type: bool default: False hostMary server address
type: str default: 127.0.0.1 portMary server port
type: int default: 59125 min: 1 max: 65535 schemeHTTP schema
type: enum default: http values: http, https
Voice options:¶
generic:¶
language- Language of voice
voice- Specific voice to use
espeak:¶
Config options:
pitch_adjustmentpitch_adjustment option
type: int default: 50 min: 0 max: 99 variantvariant option
type: enum default: m3 values: , croak, f1, f2, f3, f4, f5, klatt, klatt2, klatt3, klatt4, m1, m2, m3, m4, m5, m6, m7, whisper, whisperf words_per_minutewords_per_minute option
type: int default: 150 min: 80 max: 450