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.1.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.1-cp314-cp314-win_amd64.whl (131.4 kB view details)

Uploaded CPython 3.14Windows x86-64

retro_ru_tts-1.0.1-cp313-cp313-win_amd64.whl (130.4 kB view details)

Uploaded CPython 3.13Windows x86-64

retro_ru_tts-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (180.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

retro_ru_tts-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl (129.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

retro_ru_tts-1.0.1-cp312-cp312-win_amd64.whl (130.4 kB view details)

Uploaded CPython 3.12Windows x86-64

retro_ru_tts-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (180.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

retro_ru_tts-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl (129.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

retro_ru_tts-1.0.1-cp311-cp311-win_amd64.whl (130.4 kB view details)

Uploaded CPython 3.11Windows x86-64

retro_ru_tts-1.0.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (129.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

retro_ru_tts-1.0.1-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.1.tar.gz.

File metadata

  • Download URL: retro_ru_tts-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 0fa44b6016aee0a594f394f8093f8e2ab3de35550b01c1b15af28d1a607a7783
MD5 60c359bc8d926ea3ee2a1a1279c7405f
BLAKE2b-256 06f267c2772d7778541addf7e554895bc66bee85b3954c3d7e19508c230c728a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9a70f13548ebd5a310e934da5d72631c0610218aa2d4c600260864e0b72ca0af
MD5 1ccac45a28ce2147500b31166fefa9dc
BLAKE2b-256 ddecd1e4bcff6a815d7fe7fc4d18d42f1374e5ef070cf0630d3ae48d878b5fbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6ac8b4b9ab0fe9a5eca70d2be69e9d79565fd828186680e7ffcee9cecb24394d
MD5 d962cc55651a6095519bd3573d7e8422
BLAKE2b-256 51ec49383a00b0e6a6e367f2d5a8b8a06b4c860d0fde4e8309815a6c766f364f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 781fdfefbbbf566e685c5c5561dc466e99d16584f596ec123ed6fbd06e189f06
MD5 eddae9f781b1ed0e18fc67074dcee800
BLAKE2b-256 40607c53870e2839977521c3493e438eabd360184a29e4f211efb65aaea97a84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0865b9e64bdc132213ee9864a8b99e2292b9f6804d33f975b47e6deed11416c5
MD5 1cbdbec76fe8f510cc5cac982d158efb
BLAKE2b-256 98594087fb7dd12945164cd1efdcda0404a19091bdee6963ab572d265036c2d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a7b525f89136f686103ef45be914f2599d297f8cd165ae590bb8ef7bf8f1d8bd
MD5 e727057717d6ba25832ec781bcc82105
BLAKE2b-256 a36c14912337c2dfd537b66d644655907615d4325e2bd963361e5d4cb71d75e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 50a9c402a22d8a7f19a3c0ec694997e9bc8e6bca016dddab3307a45df8316cfb
MD5 c75f93049c7852e9398d012a34f09da1
BLAKE2b-256 c603172690d60a057417e3f3292a22bf965c9f03a921bab53451d68f1057fe47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc8b01f01ba8b9dee6ab20512d4f62fff8bb2063c2ba4db02288d96fd4500933
MD5 20f5172b18bc4314decff90ec17b2a19
BLAKE2b-256 42d323e775c5a3a50ed917db52f926a404f43f49fd6de4ca8da81cac7c1d5c1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 08c7b64f2cc020f9458320b04acd3a8181d2ae41adaa34bc07d60706e462833c
MD5 e7a5a37f84291514dad54871decf3132
BLAKE2b-256 bc9c3e4e2380eef9ff597b0f9042133b9d75eb06d5a1448fea73869514bbf56f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ad3424b07f0c7ce92124a16f4fce11e662e26aab0d8405a533e7742d1ce25efe
MD5 51d612c044f9b36fd560097d3b5cfe26
BLAKE2b-256 6e8244bf551bbbcac318a61fd6d6f5782db6db2791d9ea452b8bccf755684103

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bd4d38dad5498098c1dffe53de5b983f0dc1138ea465f1b93d44a085c09dc3ea
MD5 f18d6b3493367e2f07404eaf0a8b982d
BLAKE2b-256 df736a2afed46427fd3dd0f9c891a5debb336aa4943e969a3d8884e27136d339

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a721509da53dd253b2160c4a33ac495517ae623159f619a205131e1f2564c6d9
MD5 243eca9cfe711bb7b671b95af09d7c5b
BLAKE2b-256 7f4462c9f503b0909416c8ed4cccc4595084abc5a80fdd8d7f3585395ea64f5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e567dcaf95a6802977fcdc176c4261ae74dd1c46f25c3c309e1c243d1607a00
MD5 1a2e858e7ea26a8d7ec8191c099769fc
BLAKE2b-256 390b214001885975730e7c251dc13302afe99aa9462cd4b0e5af8fd0d10a6856

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for retro_ru_tts-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d624aade26c3e8f7477cdfd519dbea931f967d1131706c9249b82b8d6addf6c0
MD5 a23e3cc5f33a6f5e6a4d4a7ce85271a8
BLAKE2b-256 ae4e19ed02a5f48765814c432ca732291aef6fdc3862d3206fa934628db93499

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