Linux TTS player for native {{tts}} tags

AnkiWeb addon 704375187

Registers a Linux text-to-speech player so native {{tts}} tags speak, using cached Azure/Edge neural voices with Google Translate TTS and espeak-ng fallbacks.
AI-generated summary; may contain mistakes.

card-templatesbugfix-workaround

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
0 (πŸ‘ 0 Β· πŸ‘Ž 0)
Updated
2026-09-12
Anki versions
23.09~
License
AGPL-3.0 (from the GitHub repository)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python, CSV, JSON
Description language
en

Maintenance

active

  • Last update or commit: 2026-10-13 (19 days before the snapshot).
  • Test files: 10.
  • Commits in the last year: 8.
  • Issues: 0 open, 1 closed.
  • Pull requests: 0 open, 0 merged.

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.4523.09+2026-09-12
History across monthly snapshots

Loading…

Similar addons

Edge TTS for Anki

Generates Microsoft Edge text-to-speech audio from the current field in the Anki editor via button or Ctrl+T, auto-detecting languages and caching results, with customizable voices, rate, and volume.

card-creationshortcuts

11 votes 62% approval πŸ‘ 10 Β· πŸ‘Ž 1 ⭐ 10 Anki 25.02.6~ Updated 2026-10-14
Gemini Speak

Uses Google Gemini AI to rewrite selected Anki text for natural speech, then generates audio with voice, model and processing-mode controls, smart caching and no external dependencies.

card-creationai

13 votes 58% approval πŸ‘ 11 Β· πŸ‘Ž 2 ⭐ 0 Anki 2.1.66~ Updated 2025-06-11
Speech Assigner

Adds automatic text-to-speech playback and assigns TTS tags to selected fields per note type, without editing templates, supporting batch processing and language-specific voices.

review-flownote-managementcard-templatesaccessibility

1 votes 21% approval πŸ‘ 1 Β· πŸ‘Ž 0 ⭐ 0 Anki 25.09.2~ Updated 2025-12-14

Description

Anki does not ship a TTS engine on Linux. Cards that use {{tts lang:Field}} or [anki:tts] then show no players found for TTSTag(...).

This add-on registers a player so those tags speak without editing templates. Cards made on Windows or macOS that name Apple / Android / Microsoft voices still work: Anki uses the first available
voice for that language.

How it works:

  • Google Translate TTS (gTTS) for online synthesis, with a local cache.
  • If gTTS fails, falls back to espeak-ng when installed (sudo pacman -S espeak-ng or sudo apt install espeak-ng).
  • Re-registers after you switch Anki profiles (the stock gTTS sample does not).
  • Strips HTML and [sound:] tags before speaking.

Install, restart Anki, then review as usual. Put {{tts-voices:}} on a template if you want to list voices.

Disable the official "gTTS text to speech support" add-on (code 391644525) if both are enabled.

Source: https://github.com/argrig666/anki-linux-tts-player

Based on Ankitects' gTTS player example. GNU AGPL v3 or later.

README

Linux TTS Player for Anki (Edge Neural & Azure Speech)

License: AGPL v3 Anki Platform

Ultra-realistic Microsoft Azure / Edge Neural Text-to-Speech for Anki on Linux. Works seamlessly with native {{tts}} tags without requiring any API keys or paid subscriptions.


The Problem

  • macOS has the native say command built into Anki.
  • Windows has native SAPI / Windows Media Speech built into Anki.
  • Linux has NO native TTS player in Anki.

When you download shared decks or sync decks created on iOS, macOS, or Android, they frequently include tags like:

{{tts it_IT voices=Apple_Federica_(Premium),com.google.android.tts-it-it-x-itb-local:ItalianWord}}
{{tts fr_FR voices=Apple_Audrey_(Premium),Microsoft_Vivienne:FrenchWord}}

On Linux, these tags either fail completely into silence, or fall back to robotic, metallic voices. Heavy add-ons often require setting up cloud API keys, monthly subscriptions, or complicated menus.

The Solution

Linux TTS Player bridges this gap:

  1. Pristine Neural Voices: Uses Microsoft's state-of-the-art Azure Speech / Edge Neural engines.
  2. Zero Setup & Zero Keys: Works out-of-the-box with no Microsoft account, credit card, or API key needed.
  3. Universal Language & Tag Normalization: Handles it, it-IT, it_IT, ita (ISO 639-1, 639-2/3, BCP 47).
  4. Transparent Voice Aliasing: Automatically maps Apple (Apple_*), Android (com.google.android.tts-*), and Microsoft voices to their corresponding Azure Neural voices.
  5. Dynamic On-The-Fly Synthesis: Whenever you review a brand-new card, audio is synthesized in ~500 ms and cached locally. Subsequent reviews play instantly (<1 ms).
  6. Multi-Tier Resilience: If you are ever offline without internet, it automatically falls back to standard Google Translate TTS or offline espeak-ng.
  7. Optimized for Modern Linux Audio: Direct, low-latency playback via mpv integrated with PipeWire and PulseAudio, including volume compensation.

Supported Languages & Voices

Includes 322 Microsoft Azure / Edge Neural voices across 142 locales (all bundled offline in voices.json).

Language Default Neural Voice Gender Additional Included Voices
Italian (it_IT) it-IT-ElsaNeural Female it-IT-DiegoNeural (M), it-IT-IsabellaNeural (F), it-IT-GiuseppeMultilingualNeural (M)
French (fr_FR) fr-FR-DeniseNeural Female fr-FR-EloiseNeural (F), fr-FR-HenriNeural (M), fr-FR-VivienneMultilingualNeural (F), fr-FR-RemyMultilingualNeural (M)
French Canada (fr_CA) fr-CA-SylvieNeural Female fr-CA-JeanNeural (M), fr-CA-AntoineNeural (M), fr-CA-ThierryNeural (M)
English US (en_US) en-US-JennyNeural Female en-US-GuyNeural (M), en-US-AriaNeural (F)
English UK (en_GB) en-GB-SoniaNeural Female en-GB-RyanNeural (M)
German (de_DE) de-DE-KatjaNeural Female de-DE-ConradNeural (M)
Spanish Spain (es_ES) es-ES-ElviraNeural Female es-ES-AlvaroNeural (M)
Spanish Mexico (es_MX) es-MX-DaliaNeural Female es-MX-JorgeNeural (M)
Russian (ru_RU) ru-RU-SvetlanaNeural Female ru-RU-DmitryNeural (M)
Japanese (ja_JP) ja-JP-NanamiNeural Female ja-JP-KeitaNeural (M)
Portuguese (pt_BR) pt-BR-FranciscaNeural Female pt-BR-AntonioNeural (M)
Chinese (zh_CN) zh-CN-XiaoxiaoNeural Female zh-CN-YunxiNeural (M)

All standard languages supported by gTTS and espeak-ng are also supported as automatic fallbacks.


Installation

System Prerequisites

Make sure mpv is installed on your Linux distribution:

  • Arch Linux / Omarchy: sudo pacman -S mpv
  • Ubuntu / Debian: sudo apt install mpv
  • Fedora: sudo dnf install mpv

(Optional) For offline fallback: sudo pacman -S espeak-ng or sudo apt install espeak-ng.

Option A: Install via .ankiaddon File (Recommended)

  1. Download the latest linux_tts_player.ankiaddon from the Releases page.
  2. In Anki, go to Tools β†’ Add-ons β†’ Install from file...
  3. Select linux_tts_player.ankiaddon and restart Anki.

Option B: Install via Git / Manual Clone

  1. Open a terminal and navigate to your Anki add-ons directory:
    cd ~/.local/share/Anki2/addons21/
    
  2. Clone this repository directly into linux_tts_player:
    git clone https://github.com/argrig666/anki-linux-tts-player.git linux_tts_player
    
  3. Restart Anki.

Configuration

In Anki, navigate to Tools β†’ Add-ons β†’ select Linux TTS Player (Edge Neural & Azure Speech) β†’ click Config.

{
  "default_voices": {
    "it_IT": "it-IT-ElsaNeural",
    "fr_FR": "fr-FR-DeniseNeural",
    "en_US": "en-US-JennyNeural"
  },
  "volume": 140,
  "audio_output": "pipewire,pulse",
  "debug_log": false
}
  • default_voices: Choose your preferred voice for any language when a card template uses general tags like {{tts it_IT:Word}}. Prefer dedicated monolingual voices (e.g. fr-FR-DeniseNeural) over *MultilingualNeural voices for language-learning decks.
  • volume: Adjust software playback gain (default: 140%).
  • audio_output: Set mpv audio driver (default: "pipewire,pulse").
  • debug_log: Set to true to log synthesis events to user_files/debug.log.

Architecture & How It Works

flowchart TD
    A["Card Review ({{tts it_IT voices=...:Field}})"] --> B["LinuxTTSPlayer Voice Resolver"]
    B --> C{"Check Local Cache"}
    C -- "Hit (< 1 ms)" --> F["Direct mpv Subprocess Playback (PipeWire)"]
    C -- "Miss (New Card)" --> D["edge-tts Neural Synthesis (~500 ms)"]
    D -- "Success" --> E["Save MP3 to Edge Cache Slot"]
    D -- "Network / 403 Error" --> G["gTTS / espeak-ng Fallback"]
    G --> H["Save to Separate Fallback Cache Slot"]
    E --> F
    H --> F

Cache keys include the synthesis engine (edge / gtts / espeak) so a temporary fallback cannot overwrite a neural cache entry.


Troubleshooting

If neural voices suddenly sound lower quality, or debug logs show 403 Invalid response status, see SUPPORT.md. Short version for the October 2026 Edge TTS outage:

  1. Use add-on v1.1.0+ (edge-tts>=7.3.0).
  2. Clear user_files/cache/ and restart Anki.
  3. Re-review affected cards so audio regenerates.

License

GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE for details. Includes dependencies under vendor/ according to their respective open-source licenses.