Retro Russian speech synthesizer (ru_tts) wrapped for Python
Project description
retro-ru-tts
Python wrapper for the ru_tts speech synthesizer — a compact, portable Russian TTS engine written in pure C.
The core is a reverse-engineered reimplementation of the SDRV resident speech driver (BelSInt lab, Institute of Technical Cybernetics, Academy of Sciences of the Byelorussian SSR, 1990). It uses formant (diphone) synthesis: no ML models, no GPU, no large dependencies — just simple, fast, deterministic speech generation.
Quick start
pip install retro-ru-tts
# Optional: ru-normalizr for advanced normalization (Python ≥ 3.10)
pip install retro-ru-tts[normalize]
import retro_ru_tts
# Synthesize and play through speakers
retro_ru_tts.synthesize("Привет, мир!")
# Get raw PCM data without playing
pcm = retro_ru_tts.synthesize("Привет", play=False)
# Save to WAV file
wav = retro_ru_tts.pcm_to_wav(pcm)
with open("output.wav", "wb") as f:
f.write(wav)
API
synthesize(text, ...)
retro_ru_tts.synthesize(
"Привет, мир!",
# Voice parameters
speech_rate=100, # speech rate (20–500)
voice_pitch=100, # voice pitch (50–300)
intonation=100, # expressiveness (0–140)
# Gap factors (pause duration between clauses, default 100)
general_gap_factor=100,
comma_gap_factor=100,
dot_gap_factor=100,
semicolon_gap_factor=100,
colon_gap_factor=100,
question_gap_factor=100,
exclamation_gap_factor=100,
intonational_gap_factor=100,
# Control flags (bitmask)
flags=3, # default: DEC_SEP_POINT | DEC_SEP_COMMA
# Behaviour
wave_buffer_size=8192, # internal buffer (256–1048576)
play=True, # play through speakers
normalize=True, # text normalization (see below)
)
Returns: bytes — raw signed 8-bit PCM audio at 10 kHz, mono.
play(text, ...)
Shortcut for synthesize(text, play=True). Same parameters (except play).
pcm_to_wav(pcm_bytes)
Wraps raw signed 8-bit PCM into a WAV container.
Returns: bytes — complete WAV file (8-bit, 10 kHz, mono).
Flags
The flags parameter is a bitmask controlling decimal separation and voice:
| Flag | Value | Description |
|---|---|---|
DEC_SEP_POINT |
1 | Treat . as decimal separator (e.g., 3.14) |
DEC_SEP_COMMA |
2 | Treat , as decimal separator (e.g., 3,14) |
USE_ALTERNATIVE_VOICE |
4 | Use alternative (female) voice |
USE_LEGACY_RATE_ALGO |
8 | Use legacy linear interpolation rate algorithm instead of adaptive crossfade |
Default value is 3 (DEC_SEP_POINT \| DEC_SEP_COMMA), which means both . and , are accepted as decimal separators.
To use the female voice without decimal comma: flags=5 (DEC_SEP_POINT \| USE_ALTERNATIVE_VOICE).
Text normalization
By default the input text is normalized before being fed to the synthesizer. This converts numbers to words, formats dates and times, expands abbreviations, spells out uppercase acronyms letter by letter, transliterates common English words, and cleans up punctuation.
If ru-normalizr is installed
(pip install retro-ru-tts[normalize]), it is used for normalization.
Otherwise, a built-in normalizer handles the most common cases:
| Feature | Example | Output |
|---|---|---|
| Stress marks | ко́фе | кофе |
| Numbers | 1234567 | один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь |
| Dates | 15.03.2024 | пятнадцатое марта две тысячи двадцать четыре года |
| Time | 14:30 | четырнадцать тридцать |
| Units | 5 кг, 100 мл | пять килограмм, сто миллилитров |
| Temperature | -5 °C | минус пять градусов по Цельсию |
| Currency | 300 руб., 50$ | триста рублей, пятьдесят долларов |
| Symbols | 100%, №5 | сто процентов, номер пять |
| Abbreviations | т.д., т.е., напр. | так далее, то есть, например |
| Acronyms | TTS, РФ, USB | тэ тэ эс, эр эф, у эс бэ |
| Ordinals | 1-й, 3-я | первый, третья |
| Decimals | 3.14 | три запятая одна четыре |
| Phone | +7 495 123 45 67 | восемь четыре девять пять один два три четыре пять шесть семь |
| English | hello, world, ok | хэллоу, уорлд, окей |
| URLs | example.com/privet | эксэмпэл точка ком слэш привет |
| Emails | user@example.com | электронный адрес |
# Skip normalization for raw PCM output
retro_ru_tts.synthesize("Версия 3.2", normalize=False)
PCM format
| Property | Value |
|---|---|
| Format | Signed 8-bit PCM |
| Sample rate | 10000 Hz |
| Channels | Mono (1) |
Build from source
Prerequisites
- C compiler (GCC, Clang, MSVC)
- Python 3.7+ with setuptools
- Make (Linux) or build tools (Windows)
Steps
git clone https://github.com/Blue-Kod/retro-ru-tts.git
cd retro-ru-tts
# Development install (editable)
pip install -e .
# Build distribution package
pip install build
python -m build
PCM output data
The engine produces raw signed 8-bit PCM at a fixed 10 kHz sample rate, mono. This is a deliberately minimal, low-bandwidth format suitable for embedded systems, screen readers, and retro computing applications.
License
MIT. This wrapper is distributed under the same license as the original ru_tts by Igor Poretsky. 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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file retro_ru_tts-1.0.7.tar.gz.
File metadata
- Download URL: retro_ru_tts-1.0.7.tar.gz
- Upload date:
- Size: 82.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bb6e14cf926e1f5e2ed91d5d74057f3073ee4b294e764518543930798116f6f
|
|
| MD5 |
190b655a2bb7fb5853c9d2227b946247
|
|
| BLAKE2b-256 |
458d7b39f1be92d0b9cef09e245e2ba2c1cf7f56c2db81d753e56fc8b98622f0
|
File details
Details for the file retro_ru_tts-1.0.7-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 139.3 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf319a0234cb7195501cf416aa682afb8769fa55d4f95283c84e1f4a9925d9f7
|
|
| MD5 |
c68fb04aea634bba535209e37c478515
|
|
| BLAKE2b-256 |
25d469ea33953f2d747aeda14a90a00de51e717c2ae60dcb30077e6d299d3193
|
File details
Details for the file retro_ru_tts-1.0.7-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 138.2 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7937a5255c1d0e1ca50bc54db255fc245e2d51600d6ccf2461085b9d88616ae2
|
|
| MD5 |
6ebba4e16fd3aa14078a2c5192223f6b
|
|
| BLAKE2b-256 |
2321c0dca7b8fbae63c37c2ff6796862c497dfb6a8dcd481bb1d95991d8bf624
|
File details
Details for the file retro_ru_tts-1.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 188.4 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32dcdac83cb4688bf21dff47422698ccaf3af45b9c15cda580ea99284fd0fa4e
|
|
| MD5 |
6451bbe4a69c0f737d4a2d01c2f64244
|
|
| BLAKE2b-256 |
10e58a739c90361ff9d2fa93a553b0364a1753ff128c1da4a2db97caf139910c
|
File details
Details for the file retro_ru_tts-1.0.7-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 137.5 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c13edfeefe4443380aa3a90c46e601f7a0b31a48644af61af4a5aa89d91108
|
|
| MD5 |
35d5ecbb617cadc68e2a684f139c6118
|
|
| BLAKE2b-256 |
8bc39e51e91f45ac6ede61b3c12d0a1cb87808f5b7979593b3373af84b0315ab
|
File details
Details for the file retro_ru_tts-1.0.7-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 137.2 kB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e452a0b6cb26d4b8623e930690ccad5f6570ea1a7a55f820c8be2df957577ab1
|
|
| MD5 |
72bb5708abf478521395009fba72bdb0
|
|
| BLAKE2b-256 |
049b1760436e1c79cab4dd4f9d475a3546d6bbdb6bb42787ce3b706e7ab45df1
|
File details
Details for the file retro_ru_tts-1.0.7-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 138.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b25b9d1e7e6f3acd0c29e14fab6da12277747108cb224b5698c2f8bd1534ea
|
|
| MD5 |
abd7e6d3ed7ce8c43669946ba5798b0e
|
|
| BLAKE2b-256 |
be0f90ec3fec403a462349878ea3e16b5ab611a5d0d934eda5faa4ee809ffbb9
|
File details
Details for the file retro_ru_tts-1.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 188.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc55d3de6816c902cc9b58808d89be9c5754278b74ad3fbb2c1f884569f44366
|
|
| MD5 |
e1fc2cfdeb2e4150a918b8533d9a994b
|
|
| BLAKE2b-256 |
5b1f908bc79d8611954cc09a76d5f82ea3a54a2d79b565f169efa6c47f1de8f7
|
File details
Details for the file retro_ru_tts-1.0.7-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 137.5 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
888939c36845d2ea78c761a43f4fb93e053cbff3ea41962ffcc02feccff5f459
|
|
| MD5 |
72a0923b87c1ef2609e8dae8a50b5a91
|
|
| BLAKE2b-256 |
4b067066a7cacce4b50b715d55fdacc0b7df9cd1110d80c63d0f9f7b0f7aba21
|
File details
Details for the file retro_ru_tts-1.0.7-cp312-cp312-macosx_10_13_x86_64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp312-cp312-macosx_10_13_x86_64.whl
- Upload date:
- Size: 137.2 kB
- Tags: CPython 3.12, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7431495069b0c1d5e22561d281b95984c189a0d19d0a319235002e3ff115ed48
|
|
| MD5 |
201e966b9afa5b568d783e5f71e5e22d
|
|
| BLAKE2b-256 |
903b632160ae6d512e19317e5611b6750cfb23cf99cf23b4327b234d4fde3aa4
|
File details
Details for the file retro_ru_tts-1.0.7-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 138.2 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8eb45bd83fc30a10258964be4ef2488e056913d267ddc76546369ca61a2ca09
|
|
| MD5 |
bb04f5059ce9749914de3b0df0c5782a
|
|
| BLAKE2b-256 |
773343479836d11d2dfd9b619bdd1f58939da4ba84c412931c92806e66e4ed12
|
File details
Details for the file retro_ru_tts-1.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 188.0 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b76a4a0ab0f4ea087f1a50f03d2a19110fcf169debb1d3d3981eecfe57e785af
|
|
| MD5 |
2a224275642e0475e7ea503b7e90d978
|
|
| BLAKE2b-256 |
ed825d26b71f0591f6a9635f4c471ca4d8f995846287d06763a7b0facc4033dc
|
File details
Details for the file retro_ru_tts-1.0.7-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 137.5 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3bc41b4cbbbd70429f7fde0f56ccc8842e92027a668fb0ba7fd4821606914c5
|
|
| MD5 |
63eafde5906211ea523d18351a819b17
|
|
| BLAKE2b-256 |
0376e39d602593165bc627551207de36c5effcbb3738ca4acc68756313bf49dd
|
File details
Details for the file retro_ru_tts-1.0.7-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: retro_ru_tts-1.0.7-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 137.3 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53043a5c0cec134f09bc37bfcc94c28d48aeb9840a3c599efed88a86d7c515e1
|
|
| MD5 |
e5eee92cdedc9b4bbd60d1f36122850b
|
|
| BLAKE2b-256 |
41c9ba1de284b6232c4b164b790b36e98b728c0d10ee83e21224a103cadb999e
|