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.0.tar.gz (32.0 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.0-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ttscli-0.1.0.tar.gz
  • Upload date:
  • Size: 32.0 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.0.tar.gz
Algorithm Hash digest
SHA256 be11879c865a5c3d314f8faf0f3c221c942278ef6fcf2da09dd8661a8cc29651
MD5 268d6b5fb1dcb5ec2ec7f69cac1ddee9
BLAKE2b-256 c00b1a2d791bab87999df430f8715a7375313a1c71570b166f6ddc2a5aee92d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttscli-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: ttscli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dc5c813ffca98724d323f2910494193d272e8b329acb2cf5245fcd3da0695d3
MD5 03a74ff0fccb4fa775f941c1562b7df2
BLAKE2b-256 e62231daf1fc0396838ce03eaefeb18a31361e57f9e71cb85a9e6b66ae3d2412

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttscli-0.1.0-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