anki.sound#

Sound/TTS references extracted from card text.

These can be accessed via eg card.question_av_tags()

Attributes#

Classes#

TTSTag

Records information about a text to speech tag.

SoundOrVideoTag

Contains the filename inside a [sound:...] tag.

Functions#

strip_av_refs(→ str)

Module Contents#

class anki.sound.TTSTag#

Records information about a text to speech tag.

See tts.py for more information.

field_text: str#
lang: str#
voices: list[str]#
speed: float#
other_args: list[str]#
class anki.sound.SoundOrVideoTag#

Contains the filename inside a [sound:…] tag.

Video files also use [sound:…].

SECURITY: We should only ever construct this with basename(filename), as passing arbitrary paths to mpv from a shared deck is a security issue.

Anki add-ons can supply an absolute file path to play any file on disk using the built-in media player.

filename: str#
path(media_folder: str) str#

Prepend the media folder to the filename.

anki.sound.AVTag#
anki.sound.AV_REF_RE#
anki.sound.strip_av_refs(text: str) str#