Skip to main content

Download Audio

A Python utility tool to download and play MP3 pronunciations of words and phrases directly from Google TTS. It supports batch processing from text files, direct command-line strings, and StarDict index dictionaries.


Installation

Install from PyPI once the package is published:

pip install download-audio

Or install locally from source during development:

pip install .

Prerequisites: System Audio Player

To enable audio playback, your system must have one of the following command-line media players installed:

  • ffplay (part of FFmpeg — recommended)
  • mpv
  • afplay (built into macOS)
  • aplay (Linux ALSA)
  • cvlc (VLC headless)

On Ubuntu/Debian, install FFmpeg (which provides ffplay) with:

sudo apt update && sudo apt install ffmpeg

Features

  • Smart Caching & Auto-Play: Checks whether an MP3 already exists. By default, it plays pronunciations whether freshly downloaded or retrieved from the local cache.
  • Dynamic Directory Creation: Automatically creates a local ./audio/ directory, organized alphabetically into folders A through Z.
  • StarDict Support: Parses .idx files from StarDict dictionary folders to extract and download audio for entire dictionaries.
  • Text File Batching: Reads words line-by-line or separated by spaces or commas from .txt files.
  • Smart Input Resolution: Recognizes inline words without requiring extra file flags or redundant prompts.
  • Alphabetical Ordering: Supports normal A–Z or reverse Z–A processing.

Positional Arguments

  • source
    • Path to a StarDict folder (containing a .idx index file), a .txt file, or a direct inline word/phrase.
    • If omitted, the script launches an interactive prompt.

Optional Arguments

  • -h, --help
    • Show the help message and exit.
  • -f TXT_FILE, --file TXT_FILE
    • Path to a text file containing words to download/play.
  • -w INLINE_WORDS, --words INLINE_WORDS
    • Inline string of specific word(s) or phrase(s) to process.
  • -p [PLAY_OPTION], --play [PLAY_OPTION]
    • Play audio pronunciations exclusively.
  • --no-play
    • Skip audio playback during downloads or cache hits (download files without playing sound).
  • -r, --reverse
    • Process words in reverse alphabetical order (Z to A).
  • --dir CUSTOM_DIR
    • Custom directory path for audio storage (defaults to ./audio).

Usage Examples

1. Interactive Mode (Default Auto-Play)

Run the command without arguments to launch the interactive prompt. Enter a word or path to download and play it immediately:

download-audio

2. Direct Inline Word / Phrase Playback

Pass a word or phrase directly as an argument to download and play it immediately:

download-audio "hello world"

3. Download from a StarDict Directory

Extract keywords from a StarDict dictionary's .idx file, download missing audio files, and organize them into ./audio/:

download-audio /path/to/stardict_folder

4. Batch Process a Text File (Without Audio Playback)

Process a word list to populate the local cache without playing audio:

download-audio words.txt --no-play

5. Reverse Alphabetical Processing (Z to A)

Process a word list in reverse alphabetical order:

download-audio words.txt --reverse

License

Distributed under the MIT License. See LICENSE for more information.

Metadata

Release files for download-audio 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for download-audio 0.1.1
File Size Uploaded
download_audio-0.1.1.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for download-audio 0.1.1
File Interpreter ABI Platform
download_audio-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / download_audio-0.1.1.tar.gz

Download URL download_audio-0.1.1.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1ebdf49e1503277a65cd3c7b71c5944caa30871d83bd1ff239b3d009d4c27396
BLAKE2b-256 checksum
How to use checksums
ac2dc1740d73f488bd6bd0050423375c79c61b2a5c1730373fee4976debf4a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / download_audio-0.1.1-py3-none-any.whl

Download URL download_audio-0.1.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
914673b8f41b68384d174adc1ef6ad92cb0434a09ecd77ba2799bf862dcc5de3
BLAKE2b-256 checksum
How to use checksums
00df64f6cfdd754acab6b97577a7c3e1f89bd121c7f81a56079e37b606cae369
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page