Skip to main content

Text to speech with voice cloning

Project description

Speak

Text‑to‑Speech made easy with Chatterbox TTS Generate natural‑sounding speech from plain text—locally on your GPU/CPU using a single, ergonomic command‑line tool and a clean Python API.


Features

  • Voice cloning from a short audio prompt (optional)
  • Emotion control via exaggeration & classifier‑free guidance
  • Device auto‑detection — Apple Silicon (mps), CUDA GPUs, or CPU
  • Smart sentence chunking (NLTK) to handle long passages gracefully
  • Trailing‑silence trimming so outputs end crisply
  • Glitch / clipping detection heuristic for cleaner audio
  • Verification via transcription (Distil‑Whisper) to catch missing words

🛠 Installation

uv tool install speak

🚀 Quickstart (CLI)

The CLI groups everything under a single sub‑command: speak synth.

Task Command
Say a sentence speak --text "Hello, world!"
Batch from a file speak -f script.txt -o voiceovers/
Clone a voice speak --text "How do I sound?" --voice my_prompt.wav
Dial up the drama speak --text "This is **exciting**!" --exaggeration 1.2

All outputs are WAV files named after the text (or file stem) and saved to the current directory unless you pass --output-dir.

Common flags

  • --cfg-weight FLOAT  • classifier‑free guidance mix (0‑1)
  • --max-chars INT  • soft limit per chunk (default 800)
  • --save-chunks  • keep intermediate WAVs for debugging
  • --overwrite  • replace existing files

Run speak synth --help for the full list.


🐍 Python API

from pathlib import Path
from speak.core import batch_synthesize

batch_synthesize(
    inputs=[("Hello there!", "greeting")],  # (text, stem)
    output_dir=Path("out"),
)

The helper wraps all the goodies—chunking, glitch detection, ASR verification, etc.—while caching the heavy TTS model for speed.

Development

Quick Commands

  • make init create the environment and install dependencies
  • make help see available commands
  • make af format code
  • make lint run linter
  • make typecheck run type checker
  • make test run tests
  • make check run all checks (format, lint, typecheck, test)
  • uv add pkg add a python dependency
  • uv run -- python foo/bar.py run arbitrary command in python env

Code Conventions

  • Always run make checku after making changes.

Testing

  • Use pytest (no test classes).
  • Always set match= in pytest.raises.
  • Prefer monkeypatch over other mocks.
  • Mirror the source-tree layout in tests/.

Exceptions

  • Catch only specific exceptions—never blanket except: blocks.
  • Don’t raise bare Exception.

Python

  • Manage env/deps with uv (uv add|remove, uv run -- …).
  • No logging config or side-effects at import time.
  • Keep interfaces (CLI, web, etc.) thin; put logic elsewhere.
  • Use typer for CLI interfaces, fastapi for web interfaces, and pydantic for data models.

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

speaky-0.0.2.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

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

speaky-0.0.2-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file speaky-0.0.2.tar.gz.

File metadata

  • Download URL: speaky-0.0.2.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for speaky-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6b7dbcd772f547c1a95763572295b06beeb6513a5144b46dd98b4a54391fa4a8
MD5 24ae05030f58bde258b96d3bf9e79ada
BLAKE2b-256 9b81c9b16ea4fa155cb2546837e952ed15dd8d52c79406e3b3cad2f54dccf623

See more details on using hashes here.

File details

Details for the file speaky-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: speaky-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for speaky-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51c1c81d01c3721667a0c5e6740610aba310ab15a98feb552b0a3eb7db67a5ef
MD5 1869fe582dc8ffb1edc1edea8ca6fda9
BLAKE2b-256 4bed1a49410484e2c2034885da1f3e9680015100bb7b29724ce46e8da6980755

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