Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ptts for Python

Python bindings for the Phonon Rust runtime.

To try a q8 checkpoint with uv, run:

uvx ptts --model /path/to/model --lang en --quant q8 "Hello world" -o out.wav

uvx handles the isolated Python environment and package dependencies. Model files are supplied separately; --model accepts a local checkpoint directory or a Hugging Face repo ID.

To use the Python API in your own environment, install the package:

pip install ptts

Model weights are supplied separately. Set MODEL_DIR to a local checkpoint directory containing config.json, tokenizer.json, weights, and voice files. Then:

export MODEL_DIR=/path/to/model
python - <<'PY'
import os
import ptts

tts = ptts.TTS(lang="en", config=os.environ["MODEL_DIR"], quant="q8")
print(tts.voices)
tts.save("out.wav", "Hello world")
PY

For a source install, use uv add /path/to/xn-ptts/ptts-pyo3 or pip install /path/to/xn-ptts/ptts-pyo3. Source builds need Rust installed; supported CPython wheels do not.

config must name a local directory, a config.json, or a Hugging Face repo ID. There is no default model. Local paths download nothing. Rust examples, Python, and both servers use the shared checkpoint resolver. Every checkpoint supplies its own config.json and tokenizer.json. q8 prefers model.q8.gguf; other formats prefer model.safetensors. Voices come from voices/ or embeddings/, plus default-voice.safetensors as default. Hub downloads use the supplied revision for all files.

lang is required: en, fr, de, es or pt picks how numbers, symbols and abbreviations are spelled out; none uses the text as written.

Speech and voices

Reuse tts across requests. Use synth for an array, save for a WAV, or stream for chunks as they are decoded:

voice = tts.voices[0]
pcm = tts.synth("Hello", voice=voice)  # 1-D float32 NumPy array
seconds = tts.save("out.wav", "Hello", voice=voice)
with tts.stream("A longer sentence.", voice=voice) as audio:
    for chunk in audio:
        print(chunk.shape)  # process each PCM chunk as it arrives

tts.sample_rate is the PCM sample rate; save writes a mono 16-bit WAV and returns its duration. Leaving the with block stops a stream early and waits for its workers to finish. Streaming keeps bounded audio and latent buffers: leaving a stream unread pauses generation once they fill, and consuming chunks lets it resume.

tts.voices lists the voices that were found. When no voice is given, the checkpoint's configured default is used, then default if present, then the first by name. Pass voice="name" to any speech method to select one.

Command line

The package also provides the ptts command:

python -m ptts --lang en --quant q8 \
  --model "$MODEL_DIR" "Hello world" -o out.wav

--voice selects a loaded voice, and --list-voices prints the available names. Run with --help for the remaining options. The package ships type stubs and py.typed.

Wheels

Released wheels are cp39-abi3, so one per platform covers every CPython from 3.9 on, and a new CPython release needs no new wheel. Free-threaded CPython and PyPy cannot load an abi3 extension, so those two install from the sdist and compile the Rust runtime, which needs a Rust toolchain and takes a few minutes.

License

MIT or Apache-2.0, at your option. The model weights are not part of the package and come with their own license.

Metadata

Release files for ptts 0.4.0rc1

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

Source distribution (sdist)

Source distribution for ptts 0.4.0rc1
File Size Uploaded
ptts-0.4.0rc1.tar.gz 259.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for ptts 0.4.0rc1
File
ptts-0.4.0rc1-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details
ptts-0.4.0rc1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
ptts-0.4.0rc1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
ptts-0.4.0rc1-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
ptts-0.4.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
ptts-0.4.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
ptts-0.4.0rc1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
ptts-0.4.0rc1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 55.7 MB

Release files / ptts-0.4.0rc1.tar.gz

Download URL ptts-0.4.0rc1.tar.gz
Size 259.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3d60df538d8f879dd064d7fe2123f851490535b36a602a8c1edf7f670e57b30f
BLAKE2b-256 checksum
How to use checksums
442853c2f530b9a25046249a62e5e50b42b5651fe6d6cc4f5757f7e89fdf7234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-win_arm64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-win_arm64.whl
Size 6.5 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
96a9108033e1de69c0f3d4e613db1d9977174c5c3ea3eba7958e1a5e0662c7c1
BLAKE2b-256 checksum
How to use checksums
7396a43c1320c59834de78b649cc013131a10f427c32be16e4a4c8f34025eef6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-win_amd64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-win_amd64.whl
Size 6.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
817b40bfe98086b45d2b7a9a12075294cdd955363563d077bad47fd490500831
BLAKE2b-256 checksum
How to use checksums
23b834c9f9aa164b698fc3803903738b648222f7175791e61d78052579cb622b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-musllinux_1_2_x86_64.whl
Size 7.5 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c1da652cc6ad029d578c8f03e013db14754de342ca22ef4b0913171105654a0a
BLAKE2b-256 checksum
How to use checksums
7735126eaeadcdcd90a0a997025be575ee8425b0c192b1bc2bbf4dd1b83e54d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-musllinux_1_2_aarch64.whl
Size 7.0 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
9c2c28d4e4ac025eb7d34c2d6c1bd0a44ec739992dd2ea6dae15035f091ec1b8
BLAKE2b-256 checksum
How to use checksums
1dfe269dc62e5e2e6b09d5226b801ef17dc43c1fd3a9616d23affdda3178f36a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 7.5 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
86dba1c5df790d32e9718f5c79c614056724b31cba55c356763082ba1e8778a7
BLAKE2b-256 checksum
How to use checksums
ca5e30365ee15c508fb3137f172c7f43530b796a2fa40276c32da9e3ab3b4aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.8 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
fed0a8c0836a5166b4f0b4656c2dce1739ce89118f171ecbe03d1ffa0d5f4f20
BLAKE2b-256 checksum
How to use checksums
f5ead7eb8f05ca24bb8d4fac9eff3a5ace1c9c3bd57bad5aa08e7c7cecf8c529
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-macosx_11_0_arm64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-macosx_11_0_arm64.whl
Size 6.5 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
83d7d62a1c4bf623247f88e30bd102ec17c5d545c6481972f1d54a28e4074dbd
BLAKE2b-256 checksum
How to use checksums
88afcdd895d017f93d33c6421b45b22713dfcd37b812dacc4c80d0888175ddf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ptts-0.4.0rc1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL ptts-0.4.0rc1-cp39-abi3-macosx_10_12_x86_64.whl
Size 6.9 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9cf739de17462ead42f01ebcab46ad9a791e84905bf252dddd72f84f85b2f7a6
BLAKE2b-256 checksum
How to use checksums
f62275eb3bb5208b40dd4a8f25dea0746715bcdc8a56e759a9dd16da925a1a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.4.0rc1 This release

9 release files

0.2.2

28 release files

0.1.2

26 release files

0.1.1

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