aqt.tts#
Basic text to speech support.
Users can use the following in their card template:
{{tts en_US:Field}}
or
{{tts ja_JP voices=Kyoko,Otoya,Another_name:Field}}
The first argument must be an underscored language code, eg en_US.
If provided, voices is a comma-separated list of one or more voices that the user would prefer. Spaces must not be included. Underscores will be converted to spaces.
AVPlayer decides which TTSPlayer to use based on the returned rank. In the default implementation, the TTS player is chosen based on the order of voices the user has specified. When adding new TTS players, your code can either expose the underlying names the TTS engine provides, or simply expose the name of the engine, which would mean the user could write {{tts en_AU voices=MyEngine}} to prioritize your engine.
Attributes#
Classes#
Invokes a process to play the audio in the background. |
|
Generates an .aiff file, which is played using av_player. |
|
Functions#
|
|
|
Module Contents#
- class aqt.tts.TTSPlayer#
- default_rank = 0#
- voice_for_tag(tag: anki.sound.TTSTag) TTSVoiceMatch | None#
- class aqt.tts.TTSProcessPlayer#
Bases:
aqt.sound.SimpleProcessPlayer,TTSPlayer- rank_for_tag(tag: anki.sound.AVTag) int | None#
- aqt.tts.on_tts_voices(text: str, field: str, filter: str, ctx: anki.template.TemplateRenderContext) str#
- class aqt.tts.MacTTSPlayer#
Bases:
TTSProcessPlayerInvokes a process to play the audio in the background.
- VOICE_HELP_LINE_RE#
- class aqt.tts.MacTTSFilePlayer#
Bases:
MacTTSPlayerGenerates an .aiff file, which is played using av_player.
- tmppath#
- aqt.tts.LCIDS#