Skip to main content

voicesynth

Offline voice synthesis library

Install

pip install voicesynth
pip install torch --index-url https://download.pytorch.org/whl/cpu

PyTorch is not pulled in automatically so you can pick the build you want (CPU, CUDA, ...). pip install voicesynth[torch] installs the default one.

Quick start

from voicesynth import Model, Synthesizer

synthesizer = Synthesizer(Model("v5_6_ru"))
synthesizer.say("В н+едрах т+ундры в+ыдры в г+етрах т+ырят в в+ёдра +ядра к+едров.")

The model is downloaded on first use into ~/.cache/voicesynth (override with model_path= or the VOICESYNTH_HOME environment variable).

Models

from voicesynth import show_available_models, available_models

show_available_models()
show_available_models("tatar")
available_models("russian")
Family Models
Russian v5_6_ru, v5_5_ru, v5_4_ru, v5_3_ru, v5_2_ru, v5_1_ru, v5_ru, v4_ru, v3_1_ru
CIS languages v5_cis_base, v5_cis_base_nostress, v5_cis_ext
Turkic / Caucasian v5_turkic, v5_caucasian
Cyrillic v4_cyrillic
Ukrainian / Uzbek / Tatar / Kalmyk v4_ua, v3_ua, v4_uz, v3_uz, v3_tt, v3_xal
Indic v4_indic, v3_indic, v3_en_indic
English / German / Spanish / French v3_en, v3_de, v3_es, v3_fr

v5_cis_base, v5_cis_ext, v5_turkic and v5_caucasian expect stress marks (к+ошка) in the text; the nostress variant needs them only for Slavic languages. Speakers are prefixed with the language code, for example tat_albina or kaz_abai.

Speakers and speed

model = Model("v3_en", speaker="en_73")
model.set_speaker("en_12")

synthesizer = Synthesizer(model)
synthesizer.say("Hello there", speaker="en_5", prosody_rate=90)
print(synthesizer.speakers)

Saving audio

synthesizer.synthesize("Saved for later", path="audio.wav")
synthesizer.say("Saved and played", path="audio.wav")
synthesizer.audio.play_audio("audio.wav")

say() without a path plays through a temporary file. Pass ssml=True to send your own SSML, sample_rate= (8000, 24000 or 48000) to change quality, and device="cuda" or threads=4 to the Synthesizer constructor.

Audio playback is native: winsound on Windows, afplay on macOS and the first available of paplay, pw-play, aplay, ffplay, mpv, play on Linux.

Command line

voicesynth models
voicesynth models --language russian
voicesynth speakers v3_en
voicesynth say "Hello world" -m v3_en -s en_73
voicesynth say "Saved only" -m v3_en -o hello.wav --no-play
echo "Piped text" | voicesynth say -m v3_en

Logging

from voicesynth import disable_logging, enable_logging

disable_logging()

Errors

All exceptions derive from voicesynth.exceptions.VoiceSynthError: IncorrectModel, IncorrectSpeaker, ModelDownloadError, SynthesisError, AudioPlayingError, PackageError and others.

Metadata

Release files for voicesynth 0.4.0

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

Source distribution (sdist)

Source distribution for voicesynth 0.4.0
File Size Uploaded Provenance
voicesynth-0.4.0.tar.gz 15.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for voicesynth 0.4.0
File Interpreter ABI Platform
voicesynth-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / voicesynth-0.4.0.tar.gz

Download URL voicesynth-0.4.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
eee7c1bd90dada28b8e52904bc508cfd31f52be7f73e3deb9e0b8603c5e2befd
BLAKE2b-256 checksum
How to use checksums
508a83a98c6db6b6cef0d650473bf10adc67d60fa66a3b651b3e83fc85cd7837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / voicesynth-0.4.0-py3-none-any.whl

Download URL voicesynth-0.4.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dadbf9b38be446e8cf6f2c8bd17286251cae261e80587b03a05c2274e441448
BLAKE2b-256 checksum
How to use checksums
2989ba7d178c6129ec91e0416ebb681737561671501df47b7071a37d0fc16011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for voicesynth 0.4.0

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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files No provenance

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