Skip to main content

Command-line interface for text-to-speech with voice cloning

Project description

TTS CLI

A command-line interface for text-to-speech with voice cloning, powered by Qwen3-TTS.

Supports PyTorch (CUDA / CPU) and MLX (Apple Silicon) backends with automatic platform detection.

Features

  • 🎙️ Voice cloning — clone any voice from a short audio sample
  • 🔊 Streaming playback — hear audio as it generates, no waiting
  • 🍎 Apple Silicon native — MLX backend for fast local inference
  • 🎛️ Two model sizes — 1.7B (quality) and 0.6B (speed)
  • 📝 JSON output — machine-readable output for scripting and pipelines
  • ⚙️ Configurable — TOML config files or CLI flags

Installation

Requires Python 3.11+

# Basic install
pip install tts-cli

# With PyTorch backend
pip install tts-cli[pytorch]

# With MLX backend (Apple Silicon)
pip install tts-cli[mlx]

# Development
pip install tts-cli[dev]

Or install from source:

git clone https://github.com/your-org/ttscli.git
cd ttscli
pip install -e ".[pytorch]"

Verify:

tts --version

Quick Start

1. Add a voice sample

tts voice add recording.wav --text "The transcript of the recording" --voice myvoice

2. Speak aloud (streaming)

tts say "Hello, how are you today?" --voice myvoice

3. Save to file

tts say "Hello world" --voice myvoice -o hello.wav --no-play

Commands

tts say

Generate speech from text. Plays aloud with streaming by default.

tts say "Text to speak" [OPTIONS]

Options:
  -v, --voice TEXT     Voice name (default: configured default)
  -l, --language TEXT  Language code (default: en)
  -m, --model TEXT     Model size: 1.7B or 0.6B (default: 1.7B)
  -o, --output PATH   Save to WAV file
  -i, --instruct TEXT  Speaking style instruction
  --no-play            Don't play audio, only save to file
  --no-stream          Disable streaming (generate all, then play)
  --seed INT           Random seed for reproducibility

Examples:

tts say "Hello, how are you?"                      # play aloud
tts say "Good morning" --voice myvoice             # use specific voice
tts say "Hello world" -o hello.wav                 # play and save
tts say "Hello world" -o hello.wav --no-play       # save only
tts say "Breaking news!" -i "Speak urgently"       # with style instruction
tts say "Slow and steady" --no-stream              # generate all, then play

tts voice

Manage voices and audio samples.

tts voice add <audio_file> [OPTIONS]   # Add sample (creates voice if needed)
tts voice list                          # List all voices
tts voice info [VOICE]                  # Show voice details
tts voice delete <VOICE> [-y]           # Delete a voice
tts voice default [VOICE]               # Set/show default voice
tts voice default --unset               # Unset default voice

tts config

View and update configuration.

tts config show                # Show current config
tts config set <key> <value>   # Set a config value

Available config keys: data_dir, default_voice, default_language, default_model, output_format, auto_play

JSON Output

Use --json or --output json for machine-readable output:

tts --json voice list
tts --output json say "Hello" --voice myvoice

Configuration

Configuration is loaded from (in order of priority):

  1. CLI flags (--data-dir, --output)
  2. Config files:
    • ./tts.toml (project-local)
    • ~/.config/tts/config.toml
    • ~/.tts/config.toml

Example config.toml:

default_voice = "myvoice"
default_language = "en"
default_model = "1.7B"
output_format = "rich"
data_dir = "~/tts"

Data Storage

All data is stored in ~/tts/ by default:

~/tts/
├── voices.json       # Voice definitions and metadata
├── samples/          # Audio samples for voice cloning
└── generations/      # Generated audio files

Requirements

  • Python 3.11+

  • PyTorch backend: torch, transformers, qwen-tts

  • MLX backend (Apple Silicon): mlx, mlx-audio

  • Audio: soundfile, sounddevice

  • System dependency: SoX (required by qwen-tts)

    # macOS
    brew install sox
    # Ubuntu/Debian
    sudo apt install sox
    

License

MIT — see LICENSE for details.

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

ttscli-0.1.1.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

ttscli-0.1.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file ttscli-0.1.1.tar.gz.

File metadata

  • Download URL: ttscli-0.1.1.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ttscli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6f51b3f007bfa8274be4bc8ad883b8957f90c843df3f5d70cc54ae411f7faaa7
MD5 efd6e8b52228de42f269670adbcc5d38
BLAKE2b-256 22ded4a5987937d2d6488d43f0dc4e29ecbf4a1c0f25080a8404253721cef8a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttscli-0.1.1.tar.gz:

Publisher: pypi.yml on jiweiyuan/ttscli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ttscli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ttscli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ttscli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe5b134534683d061cf3d6cc05bccf2372a67a34898153a51027c2b36c3d55b0
MD5 35774c7cf49a4f371e6ef50a849ee1c8
BLAKE2b-256 6ffe36cd46229e1217c2b5d3d03f5ad2f7b0144ea7d69a6f2b36e7cdd271c189

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttscli-0.1.1-py3-none-any.whl:

Publisher: pypi.yml on jiweiyuan/ttscli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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