Skip to main content

Retro Russian speech synthesizer (ru_tts) wrapped for Python

Project description

retro-ru-tts

Читать на русском | GitHub

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
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 via ru-normalizr in TTS mode before being fed to the synthesizer. This converts numbers to words, formats dates, handles cases, transliterates English words, etc.

# Skip normalization for raw KOI8-R 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

retro_ru_tts-1.0.3.tar.gz (80.4 kB view details)

Uploaded Source

Built Distributions

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

retro_ru_tts-1.0.3-cp314-cp314-win_amd64.whl (137.9 kB view details)

Uploaded CPython 3.14Windows x86-64

retro_ru_tts-1.0.3-cp313-cp313-win_amd64.whl (136.9 kB view details)

Uploaded CPython 3.13Windows x86-64

retro_ru_tts-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (187.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.3-cp313-cp313-macosx_11_0_arm64.whl (136.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

retro_ru_tts-1.0.3-cp313-cp313-macosx_10_13_x86_64.whl (135.9 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

retro_ru_tts-1.0.3-cp312-cp312-win_amd64.whl (136.9 kB view details)

Uploaded CPython 3.12Windows x86-64

retro_ru_tts-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (187.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.3-cp312-cp312-macosx_11_0_arm64.whl (136.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

retro_ru_tts-1.0.3-cp312-cp312-macosx_10_13_x86_64.whl (135.9 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

retro_ru_tts-1.0.3-cp311-cp311-win_amd64.whl (136.8 kB view details)

Uploaded CPython 3.11Windows x86-64

retro_ru_tts-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (186.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.3-cp311-cp311-macosx_11_0_arm64.whl (136.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

retro_ru_tts-1.0.3-cp311-cp311-macosx_10_9_x86_64.whl (136.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file retro_ru_tts-1.0.3.tar.gz.

File metadata

  • Download URL: retro_ru_tts-1.0.3.tar.gz
  • Upload date:
  • Size: 80.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for retro_ru_tts-1.0.3.tar.gz
Algorithm Hash digest
SHA256 10cf07d1586535b2890cfb2c5eb5f390fba36a4a6a20e8427ce55b59cc3dbdf5
MD5 447790e72d9fb94b82b7bc9d85a109c8
BLAKE2b-256 1317d37b0adedbb9b750727b1901d09d169e0699ffe960b5259892231eca6a16

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d690daeb0e8a4c38e62c703e2358b99dac5bf835a41adf55166c8b02cf4521b6
MD5 10efd505c2677089fc55fe72c42d46ed
BLAKE2b-256 30e3262ef78eafc4f7c60012f637902b47b6e62a1de103ceeb3a89a070e99cee

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 57226b683d2f795b53e853bd96ad886857222a96772ff3c07f791e7c8c25dcc8
MD5 ae48e22b2e4c41bcd628e4a2abcd29c8
BLAKE2b-256 becaad8262a5105c76cb6d4a730abe20fea281e195cfa591726bd5be455bcf9e

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a6bc1dbf03840698e0a111e06ff554619fa0c465e083bce6a1eef933447dfe1
MD5 4d976368c1a48624dc38e0ed28a60627
BLAKE2b-256 875be011dba05dacd754e6d74db0124e4fe53778d0880017b9fefbea84c6dfd5

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a08c81e8add2d5357cb1dfe9d81ec8eae94c84783b4122ac0e46d155030fa4c5
MD5 68b50d7353b39a9f06ac702e0bcc917d
BLAKE2b-256 38715c9a45018d0863ba6fb6b31e0d9f082df49739fd104d1fa87cb2b0a1c84d

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 dcc4edc17c5268c40a8fd9b74b4bbeac32bd0712dbbec31294f062ee801aac71
MD5 2c287c3dbc3a619a76223cfe8d86497e
BLAKE2b-256 bfa0f0966029e2a051f6f53229180d2d517477fae29a17be3eb05ba6592da70f

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2bfceb597be1ce6b978c00cbcdb5688a667527690b2277ea930ae851863bddf0
MD5 8eebe7174477714b27c7ff016a98d20b
BLAKE2b-256 02aa1bdbe4967f29325a8b00cf4fb3e8df7187a1f1142c65ae1cc4deb1591255

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 741367f2eddae183ca77b502a3dbc27042a34b7f0e31e6ea13ac9f7b6f27fa94
MD5 66f5a4d510f20b22ab282d55af004788
BLAKE2b-256 c798590c2e3d3f67389af14dd0eb7a1b7ca9205f9de9b06826c254cbfa979fff

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22f3d524b909c87dd57d7327010ec632f28872af5fa71bd3e01d15697828df5d
MD5 7c8a26de6ac89393cfd0454852f24119
BLAKE2b-256 f353fb2d4ec76cc2a800825825e0fee877f76a5ebbec4bb6db228775fc675cc1

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 882f5f269c4d615b162b5f46209cabccdb86a20c491d274caa6ed55b6cdae227
MD5 5d451d34581a6286757780e6ac21e9fd
BLAKE2b-256 b856039165c97b0a10bc6e9370cec8e1c21121cbc80e816a6b24240181ffb9eb

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ade67e85549336c6dc8d31567aa618da34aa2370ec44743021d0365256c37467
MD5 2fa9c133dbc35501a13e665600afb7db
BLAKE2b-256 ac95cd8db144e8e8f0c93c5e859fdb93778f3adb20a819f5f8b2291e9484ea13

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6db00036fdc8c70ec9d370c8f61388aeeac5f9945e8b7a4ce6ad8af3e8a5f798
MD5 43438b8d258c69b9a8ecddfa57255eb0
BLAKE2b-256 3de28f5a21f9a2026b4041d6767167fe6b084f78a22c8a79cb8bf6465dfacf5c

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a4f8461ac67e2f351ec809bc3718404aa47f6604e16bd58d09dbe0880ca78f6
MD5 8ba69097e8ced9ab43f510e0b0fd95ea
BLAKE2b-256 3bd92dcdef7bbc947ac1dcbb316aab896d6259f1284d3379e2ba4e1e088c941d

See more details on using hashes here.

File details

Details for the file retro_ru_tts-1.0.3-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for retro_ru_tts-1.0.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 963d9d3563ed8eb741941a7f5425d5b83d301d5bff6def00652acb9530032c24
MD5 26ff15f61666ec784ada09e50f5cb7c7
BLAKE2b-256 fb4c423a220a84a59eeecb9c621626c87c95c93e6a1725cd6ef9539acfc53314

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