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.2.tar.gz (80.0 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.2-cp314-cp314-win_amd64.whl (137.5 kB view details)

Uploaded CPython 3.14Windows x86-64

retro_ru_tts-1.0.2-cp313-cp313-win_amd64.whl (136.5 kB view details)

Uploaded CPython 3.13Windows x86-64

retro_ru_tts-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (186.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.2-cp313-cp313-macosx_11_0_arm64.whl (135.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

retro_ru_tts-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl (135.5 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

retro_ru_tts-1.0.2-cp312-cp312-win_amd64.whl (136.5 kB view details)

Uploaded CPython 3.12Windows x86-64

retro_ru_tts-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (186.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.2-cp312-cp312-macosx_11_0_arm64.whl (135.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

retro_ru_tts-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl (135.5 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

retro_ru_tts-1.0.2-cp311-cp311-win_amd64.whl (136.4 kB view details)

Uploaded CPython 3.11Windows x86-64

retro_ru_tts-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (186.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.2-cp311-cp311-macosx_11_0_arm64.whl (135.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

retro_ru_tts-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl (135.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: retro_ru_tts-1.0.2.tar.gz
  • Upload date:
  • Size: 80.0 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.2.tar.gz
Algorithm Hash digest
SHA256 2c5ee66fbc5eef86b67d74b58fcc20bb08d55f063a76bc915aa04777901854ee
MD5 7f866cca037e27a76415ba576ac7135f
BLAKE2b-256 a65515186fd7214e95324adbe2a40e2f868330cc66e192ceb1c8bc1ddfdf8948

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 68e562d661feaef0f7697da690b588f63efdebfdbfed29925b3fbc8f65074e1f
MD5 0c6850453a0c5f3226e1b2fb4c4b771c
BLAKE2b-256 64d457b61c3a61fd67b53818ed05903b35e652c3116f12c539334dd28e1e027e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c08f5496eacb1602b2df210a665c63939e720ff9730df1910a73afcf29ef85d4
MD5 b94cbb80b6d1a9d3086011deb171db65
BLAKE2b-256 368e2f7aac5646eadb1f5d0850914e5e990075d375bd675d6025c5c507783497

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6650571280e3f3daa11d2f456e7726112db2754a70fb003b53b38b5b8404dae1
MD5 6c98638866902df25abe0564b795898d
BLAKE2b-256 7e11a6f803aedf6c3a76249deb99fbacd2cc983de16c327275338ab09f26f7ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd7429571d4418b14759356e2abcfc5a27af88017d98ced54ac4c5d448909ed6
MD5 b11e9ace70b1d14132b9c60a5f312cbf
BLAKE2b-256 7d6d6eeae3be7e179115d4283e90b1d8233e3b50004301b579ca21262ef22d53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 761c555faf6f3c3fc8ae67883fbe13b3e592d20b458f3849cea4c13811eb785b
MD5 9a9ecd195b95c717e8b636b8f2088e5e
BLAKE2b-256 0005fa9507ef17e210251cf573b608107a213f1caa1dd7f445aad74a5789a4a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2b8e74513b8dd57c13418cb535d7c95a29a63395ccfeddfc8648fda6a9b96538
MD5 f16dd6a1dd93d8f8fbae513197c39c78
BLAKE2b-256 fcc71cf5e36e73fa89af007c269c697d5e260af1b5c6ac49f36c9da364e67ce9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 814ccff061939bb2c45ce0946e73ab4e01a81c21fd3b1e40c6e043f1232c804e
MD5 5380a04ef790ebfc77ba2edbda221249
BLAKE2b-256 19fea09fe8053de469b1a34ed7b1cbabce6187dd30ba3e1e5ffd21669decebbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f0eccc6a9cb3194c2033b2ee3a4b965e6d5c5e08510270b46b2c9549288fc5d
MD5 e3a146a2afdbbde48fa12fd1295aed31
BLAKE2b-256 c865e81ef3ee57dc29ff0d6d2d8e8e89176ce699eb1d655279ad374dc6dcebc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4fbab544de3e51624864256c838a251a08f934fbe63f88065d489fa020ae74c9
MD5 00c09ac14c8e76b5a267c69b9cc69e5b
BLAKE2b-256 77c318194e7121d070ae8b5061f2a4ee7cf7207ea2e1efde5284fca9e9a55c14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 66513b9ba9270e4182a7414e06692b0f590a7a13c6aa4fc674f39fd1ecd64fda
MD5 8b3c6524d57f5566394e85d9f887210b
BLAKE2b-256 5797b4a2ab2ac8f855cc586dfe2a3bde31efcf3a283fa5d64004e6eba8b5a697

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2bf8c67f8f0cfa32d4f87e0d1359b86e8260f79bbe982d20c1e6b77afcc71591
MD5 cca1054dba554b80fcf94f739d46cc13
BLAKE2b-256 b020186fd3af1700694263f5704f0148c28ce927a597f767d85b05e8fa163a7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb44386e590412ff451314e3328763e423faaaf95d0a41ed076c8fc9009d4b95
MD5 fe88c9e78652a9c428d036cd942214f0
BLAKE2b-256 2cb205e8972cac2853c332f8941474206fca65d6a1de5f674bd0a783e14c4b5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8d0d2ccdb152922e314ef5015942cb27832a5ffd1ea621cda93b6da49476701f
MD5 ccce62aa600d9ef77e7f3e95818f5315
BLAKE2b-256 66dfb9885ccebb9162e5b5e139357e969b77123e1cfa56c4e14865b6314b1038

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