Skip to main content

A CLI tool to synchronize Anki notes with high-quality Azure TTS audio.

Project description

ankiazvox

ankiazvox is a professional CLI tool designed to synchronize Anki notes with high-quality neural audio powered by Azure Cognitive Services. It automates the process of fetching text, stripping HTML, generating speech, and updating your Anki cards.

✨ Features

  • Neural TTS: Uses Azure's state-of-the-art Neural voices for natural, human-like speech.
  • HTML Sanitization: Automatically strips HTML tags (like <br/>, <div>) from your Anki fields to ensure clean speech synthesis.
  • Overwrite Protection: Smartly skips notes that already have audio to save API quota, with an optional --overwrite flag.
  • Seamless Integration: Automatically uploads audio to Anki's media folder and updates the [sound:...] tags via AnkiConnect.
  • Voice Explorer: Built-in command to list and filter available Azure voices by locale.
  • Auto-Cleanup: Automatically removes temporary audio files after synchronization is complete.
  • Flexible CLI: Built with Click for a smooth command-line experience.

🚀 Installation

1. Prerequisites

  • Anki Desktop with the AnkiConnect add-on installed.
  • An Azure Speech Service subscription (Key and Region).

2. Install via pip

pip install ankiazvox

3. Install from Source

git clone https://github.com/ericxu131/ankiazvox.git
cd ankiazvox  
pip install .

⚙️ Configuration

Create a .env file in your working directory (or specify one via --env):

# AnkiConnect Settings  
ANKI_CONNECT_URL=http://127.0.0.1:8765

# Azure Speech Settings  
AZURE_SPEECH_KEY=your_azure_api_key  
AZURE_SPEECH_REGION=your_service_region (e.g., eastus)

# Default Voice Configuration  
DEFAULT_VOICE=en-US-AvaMultilingualNeural

🛠 Usage

You can use the azv alias or the full ankiazvox command.

1. Synchronize Audio (sync)

Sync notes from a deck. By default, it skips fields that already contain audio data.

azv sync --query "deck:English" --source "Front" --target "Audio"

Force overwrite existing audio and limit to 5 notes:

azv sync -q "tag:review" -s "Word" -t "Sound" --overwrite --limit 5

Option Short Description
--query -q Anki search query (e.g., deck:Default)
--source -s Field name containing the text to synthesize
--target -t Field name where the [sound:...] tag will be saved
--overwrite Force update the target field even if it has a value
--voice -v Override the default Azure voice
--limit Max number of notes to process
--env Path to a specific .env file

2. List Voices (list-voices)

Explore available neural voices:

azv list-voices --locale zh-CN

🤝 Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License.

👤 Author

Eric Xu - xulihua2006@gmail.com
Project Link: https://github.com/ericxu131/ankiazvox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ankiazvox-0.3.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ankiazvox-0.3.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file ankiazvox-0.3.0.tar.gz.

File metadata

  • Download URL: ankiazvox-0.3.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.13 Darwin/25.2.0

File hashes

Hashes for ankiazvox-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c50f1f9f379b93336e26a3467b7ff31f22181b237d5a3d16c379eeee99b7f2d3
MD5 48de116afd9ca2c9a726e95e3f6e77c4
BLAKE2b-256 752a173eb6a55a4524ccb417d8ac896e58b1051b7e7b80379e92e24b5b30ed17

See more details on using hashes here.

File details

Details for the file ankiazvox-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ankiazvox-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.13 Darwin/25.2.0

File hashes

Hashes for ankiazvox-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a569ca37ec911c11f1a3c55fa7da31d39654311fb8d4077421d3190013641d4
MD5 990a1dafbf0ce10f22c2b03f97a6b127
BLAKE2b-256 d5ef095a94aa0cbaf4b054d04e9fa0fb897fe90c7cca7b4aa4436588133a5c6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page