Python bindings for Lithuanian language synthesizer from LIEPA project
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file liepa-tts-0.1.0.tar.gz
.
File metadata
- Download URL: liepa-tts-0.1.0.tar.gz
- Upload date:
- Size: 50.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Linux/5.0.0-23-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2809e90b0048cb1510438076db5112ace88e31d20ad6a5cc760968b8ab568bce |
|
MD5 | 9773dac70e8628d5d73d9896b6b304a8 |
|
BLAKE2b-256 | a21ebc355d671c9c9125c61f49e18d1af0bb37f424f68ea56c5c935d27ba34d5 |