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_languages
list. Higher number skews towards preference. engine_preference
- Specify preferred engines in order of preference.
**config
Engine-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
lang
isNone
, 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
espeak
and optionallymbrola
to be available.Initialization options:
enabled
Is enabled?
type: bool default: True espeak
eSpeak executable path
type: exec default: [‘espeak’, ‘c:\Program Files\eSpeak\command_line\espeak.exe’] mbrola
mbrola executable path
type: exec default: mbrola mbrola_voices
mbrola voices path
type: str default: /usr/share/mbrola passable_only
Only 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
festival
to be available.Initialization options:
enabled
Is enabled?
type: bool default: True festival
Festival executable path
type: str default: festival
flite:¶
-
class
talkey.engines.
FliteTTS
(**_options)¶ Uses the flite speech synthesizer.
Requires
flite
to be available.Initialization options:
enabled
Is enabled?
type: bool default: True flite
FLite executable path
type: str default: flite
pico:¶
-
class
talkey.engines.
PicoTTS
(**_options)¶ Uses the svox-pico-tts speech synthesizer.
Requires
pico2wave
to be available.Initialization options:
enabled
Is enabled?
type: bool default: True pico2wave
pico2wave 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:
enabled
Is enabled?
type: bool default: False host
Mary server address
type: str default: 127.0.0.1 port
Mary server port
type: int default: 59125 min: 1 max: 65535 scheme
HTTP schema
type: enum default: http values: http, https
Voice options:¶
generic:¶
language
- Language of voice
voice
- Specific voice to use
espeak:¶
Config options:
pitch_adjustment
pitch_adjustment option
type: int default: 50 min: 0 max: 99 variant
variant 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_minute
words_per_minute option
type: int default: 150 min: 80 max: 450