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.0.tar.gz (72.5 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.0-cp314-cp314-win_amd64.whl (131.3 kB view details)

Uploaded CPython 3.14Windows x86-64

retro_ru_tts-1.0.0-cp313-cp313-win_amd64.whl (130.3 kB view details)

Uploaded CPython 3.13Windows x86-64

retro_ru_tts-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (180.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.0-cp313-cp313-macosx_11_0_arm64.whl (129.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

retro_ru_tts-1.0.0-cp313-cp313-macosx_10_13_x86_64.whl (129.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

retro_ru_tts-1.0.0-cp312-cp312-win_amd64.whl (130.3 kB view details)

Uploaded CPython 3.12Windows x86-64

retro_ru_tts-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (180.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.0-cp312-cp312-macosx_11_0_arm64.whl (129.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

retro_ru_tts-1.0.0-cp312-cp312-macosx_10_13_x86_64.whl (129.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

retro_ru_tts-1.0.0-cp311-cp311-win_amd64.whl (130.3 kB view details)

Uploaded CPython 3.11Windows x86-64

retro_ru_tts-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (180.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

retro_ru_tts-1.0.0-cp311-cp311-macosx_11_0_arm64.whl (129.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

retro_ru_tts-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl (129.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: retro_ru_tts-1.0.0.tar.gz
  • Upload date:
  • Size: 72.5 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.0.tar.gz
Algorithm Hash digest
SHA256 ffbedd675f8866fe5aeeeb5b83856766ac7251ddba5758ce5eaa6420f37bc7a9
MD5 bffb45571c7318e0fd58632d0e09041f
BLAKE2b-256 363021df0d61a0c6e05e43257a40a0ec2d6c8acaa81e5de60359fd89aa9717d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 8d21e2cd474667a9474a854b3fc5851fabd551ab1c314d785638a4dd517e3ffc
MD5 761d2e47e4d57a466a6787e190146a2a
BLAKE2b-256 5f4bd5c3d080430811a765ae5242f3735b7c2b39ca5920eeb011358f7ddac665

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 87541a0e44c1a48eaf16f52e195270c8553090a39098c6a552affb0411117ac0
MD5 d56be88cc2adfa7f7237e3745c4c9576
BLAKE2b-256 ca9edd0d05076b81c70861ced4f2f110e979c2823d1d01401418b2b1323bd738

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 251cdb069a75cfae948e2cbca4f80b62f85d890a2bfc0ad9186a458f7586dccf
MD5 f85228d203e7aa971f3126cb476daf7d
BLAKE2b-256 92d94d4888bfab20505c2af171c397e4a2da18067283ee9468acd59a978be2c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af5bef9635e8b7bf88032f5e0755b026a5b741c9c6aa24e72e38c440fc0c2e3a
MD5 80da87ade8f21df0e4099e3fe675631a
BLAKE2b-256 b7be97962377c4426efb9eb3d12dc5850e2a8ef92a154ea26adff2567edd198b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 882938c5689aa324ff4029b20393fcaac6687a51ccadd83d19c1459032682289
MD5 6f4071a2f99b47b896856ea43f5b2fca
BLAKE2b-256 36366ae96e797b0fd918e5265f4981b8b61fef100f00e9988059a9107ce9077d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 82fb10a6f7eeb72d1b5a8b6712416003402067187512b781fcd59600918097c5
MD5 b8f7b5d415b1fa95e41acf41a19ac18f
BLAKE2b-256 e07007c560e9b33d62adf528c8a28fa3bc6f34e12faae4b3135349e2f6518e3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a52e591ed346629a196a3a1a4088fe2c96714c8df0220fb26b5ed879c1a96ed
MD5 b6ead8c10b1ab298d455f4ae84c43b63
BLAKE2b-256 061aa2c76da303f6dd993a5e2d0a87b9fe587efd461cefcb420eebfa48f0d273

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e334a9cecc7b21b436112908a9e51312f9fae7187b4a28d1387ad67c1069f96f
MD5 00a9b4c00b719a927e40333a4863c956
BLAKE2b-256 1b285ae1ae214d577903ffff07c99ee9ffdf5a241f9c87d155dbb02a2124c8db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e34e3266b2d9f08fdac2e786d80dfefa67e2f8e7d1c3da82d1ce662f248de56d
MD5 f6a51e844962acf939bcd9ebff6241ac
BLAKE2b-256 6c45cac38fbc1458a0ad50508e24cfe02acd0548e19831f0635adcb34fe15243

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d4cb299fa3685a18cabd9bc9de10ab7bbd1b3b6add47e78a80cc77d24316163d
MD5 b41932e83a3192346324e83a72698af2
BLAKE2b-256 50102a193078ea9eb0cebac3f86ae74bdab69a752796a746026da9659223bb14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e2f56515c9ca00eb6103e482516b0e3d8303668a3da549f58cd3e32befb2e1e
MD5 cc6dcc8a78d6600c20085a1b97c5ed19
BLAKE2b-256 b0f6962eb231d8d70e83043af267fefb32441cdd51f621331a95cd92500fe5e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 58b1b65af80155f0b0c0283c8efad85a37d544a05f4ad1e67881f84a437513a4
MD5 a85457706e663858885ea5c30be4650c
BLAKE2b-256 2a54eeff0210d185b743bf02ff1e257df6f2f1629fb9141ad8f98e7ae584147b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 33573d8346241c0422a7fdb9bbd10131129cb513329c528d27287513e454914e
MD5 4147a5497782d05d22a73c7f28c75f97
BLAKE2b-256 0b360e4153726690f8e15fe246fc360635cc901cce3c01e38282063df6e2d512

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