Skip to main content

LIEPA

Lietuvių šneka valdomos paslaugos (Lithuanian speech controlled services)

This project aims to provide high quality digital Lithuanian speech services for free. So far there are several services provided at various stages of completeness, such as Lithuanian speech recognizer and Lithuanian speech synthesizer.

This package wraps the latter.

Dependencies

For this package (liepa-tts) to work you need synthesizer binaries which you'll have to compile yourself.

The original sources can be acquired here

To make it easier to build binaries for platforms other than Windows you can acquire fixed-up sources here: laba-diena-tts

Once you build binaries from the native-modules subtree make sure they are available on LIBRARY_PATH (for building) and LD_LIBRARY_PATH (for runtime).

Installation

I highly recommend Poetry

poetry add liepa-tts

If you must, use pip:

pip install liepa-tts

You need numpy available for building C extension, so if you get errors first install that:

pip install numpy

Usage

from liepa_tts import liepa

# All strings must be encoded with Windows Baltic encoding
ENCODING = "cp1257"

# First parameter is the path to data directory
# Second parameter is the path to voice directory
# All paths must include trailing slash
# Returns error code
liepa.init("data/".encode(ENCODING), "data/Edvardas/".encode(ENCODING))

# Parameters:
# text: String that will be syntesized
# outSize: Integer. Typically this takes ~3072 per phoneme (letter), if it's too small you'll get buffer overflow errors
# speed: Integer. The larger the value the slower the voice will talk. Can be negative.
# tone: Integer. The pitch. Larger values make for higher pitch. Can be negative.
# Returns tuple (error code, ndarray). ndarray contains wav data without headers as array of integers.
text = "Laba diena. Kaip jums sekasi?".encode(ENCODING)
err, buff = liepa.synth(text, len(text) * 3072, 100, 0)

# Parameters:
# buff: The ndarray returned by liepa.synth() method
# filename: encoded path to output file
liepa.toWav(buff, "test.wav".encode(ENCODING))

# Call this when you're done to free resources
liepa.unload()
Notes:

Error codes produces by the synthesizer are defined in include/LithUSS_Error.h so if you need more info on the error you're getting check that file.

You can acquire the data files along with original sources here

The files that must be present in data/ directory are:

  • abb.txt
  • duom.txt
  • rules.txt
  • skaitm.txt

You should extract voice directories unmodified.

The .wav produce by the synthesizer is completely unoptimized and contains a lot of silence. Therefor you should further process it before usage.

Release files for liepa-tts 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liepa-tts 0.1.0
File Size Uploaded
liepa-tts-0.1.0.tar.gz 50.5 kB Details

Release files / liepa-tts-0.1.0.tar.gz

Download URL liepa-tts-0.1.0.tar.gz
Size 50.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2809e90b0048cb1510438076db5112ace88e31d20ad6a5cc760968b8ab568bce
BLAKE2b-256 checksum
How to use checksums
a21ebc355d671c9c9125c61f49e18d1af0bb37f424f68ea56c5c935d27ba34d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.7.3 Linux/5.0.0-23-generic

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page