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. Until the stable release, use uvx --prerelease allow ptts to run the preview. Model files are supplied separately; --model accepts a local checkpoint directory or a Hugging Face repo as hf://owner/name.

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

pip install ptts

The wheel contains no model weights. Without a model argument, TTS downloads the default model on first use and caches it:

import ptts

tts = ptts.TTS(lang="en")
print(tts.voices)
tts.save("out.wav", "Hello world")

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. See the development guide for repository build commands.

model, the first argument, names a local directory, a config.json, or a Hugging Face repo as "hf://owner/name" or "hf://owner/name@revision". Left out, it is ptts.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 revision after @ for all files. config= and revision= still work but are deprecated.

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, and tts.languages the languages the checkpoint's config says it was trained for. 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. With voice_catalog= naming a catalog, an hf://owner/name[@revision] repo or a local voices.jsonl, a name the checkpoint does not have is looked up there, by name in any case and with or without accents, or by its voice ID. Only that voice is downloaded, on first use, and then joins tts.voices. ptts.catalog_voices(catalog) lists a catalog without loading a model.

Command line

The package also provides the ptts command:

python -m ptts --lang en "Hello world" -o out.wav

--model loads another model, as TTS's first argument does. --voice selects a voice of the checkpoint or of --voice-catalog, and --list-voices prints the catalog's voices. 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.0rc3

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.0rc3
File Size Uploaded Provenance Actions
ptts-0.4.0rc3.tar.gz 284.4 kB Without provenance Details for ptts-0.4.0rc3.tar.gz

Built distributions (wheels)

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

Total release size: 56.0 MB

Release files / ptts-0.4.0rc3.tar.gz

Download URL ptts-0.4.0rc3.tar.gz
Size 284.4 kB
Tags Source
SHA-256 checksum
How to use checksums
33d3c7ff1f184f4a8f5e36b3448a6d47d08b8aa58633a7aa64af407761614cb6
BLAKE2b-256 checksum
How to use checksums
8ff7ecd9cad3e09c7575f5e0166cb1e08ebc91eb243433e91b765612a62fcd3b
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.0rc3-cp39-abi3-win_arm64.whl

Download URL ptts-0.4.0rc3-cp39-abi3-win_arm64.whl
Size 6.5 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
ed722ccaeb714d4e91ed83ccb7c4c50e4c41502268c82d2ac9ac1f410d1e0b51
BLAKE2b-256 checksum
How to use checksums
26e92f7262fec19202bf33853bab626cf0f0d09474e95729fb921515e6e26a95
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.0rc3-cp39-abi3-win_amd64.whl

Download URL ptts-0.4.0rc3-cp39-abi3-win_amd64.whl
Size 6.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4d160ea2f684a081ba314c7cec0b0b3cc9abf1af6c14cc68cfd24a60ec853989
BLAKE2b-256 checksum
How to use checksums
692379370428ec2dd1513173a8209c2c04a9e2ee804d27edfcf406189332ac31
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.0rc3-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL ptts-0.4.0rc3-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
dbcf06622e394208ff945dbb656b761b7484b9a7d4212bb6d538c01c95ea36e2
BLAKE2b-256 checksum
How to use checksums
c75573e4875864c484822718795dc3f24a92f54c09e76c8b8db7a9a280e6cf03
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.0rc3-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL ptts-0.4.0rc3-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
bdcc3e3a3ba652a6bb2b13fbd1642bb81b10a08358ee9c2c5df6e64c9b837c91
BLAKE2b-256 checksum
How to use checksums
31260a3503e7bdd285a8261db68241226283127c1f8f5c9337fa28316cba8edc
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.0rc3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ptts-0.4.0rc3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 7.4 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
7c661afc0d37b402a499824944f6fed53dc0bb38e97345ecd32aaaa1253a91b6
BLAKE2b-256 checksum
How to use checksums
8855ae0f31345d6552adcda7b3ca2d22fbd9383c82c51eac8cb3521624ea0383
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.0rc3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL ptts-0.4.0rc3-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
637fd9f971faee50d626a0c67777ec8fbbdc6669c61e099ba0b3acd5853440f7
BLAKE2b-256 checksum
How to use checksums
507507cc78833f5de6ac806bdf696e744ceaf9ca7c7835e8c915f7aeef1a1af3
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.0rc3-cp39-abi3-macosx_11_0_arm64.whl

Download URL ptts-0.4.0rc3-cp39-abi3-macosx_11_0_arm64.whl
Size 6.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d101f05363d3421bdd0aeed3644d72c0bd82e6436fb68b736719c53bb69d6688
BLAKE2b-256 checksum
How to use checksums
c5f9109759c0cf5bd02e532a73fb36f5a92f5b87fc6acf467401cc418f5a916c
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.0rc3-cp39-abi3-macosx_10_12_x86_64.whl

Download URL ptts-0.4.0rc3-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
16bbfaf64158ca7b8686225e4d7f5e9d78c299d2b5310a758db46f874cb48c50
BLAKE2b-256 checksum
How to use checksums
e6f83c82eb3d02a8ff0431abf16562314c5546191356f56e0e71d7853c36a6ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Security for ptts 0.4.0rc3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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