LIEPA项目的立陶宛语言合成器的Python绑定
项目描述
LIEPA
立陶宛语音控制服务(Lithuanian speech controlled services)
该项目旨在免费提供高质量的立陶宛数字语音服务。到目前为止,已提供了一些处于不同完成阶段的服务,如立陶宛语音识别器和立陶宛语音合成器。
此包封装了后者。
依赖项
要使此包(liepa-tts)工作,您需要合成器二进制文件,您必须自行编译。
原始源代码可以在此处获得:这里
为了更容易为Windows以外的平台构建二进制文件,您可以从这里获取修复后的源代码:laba-diena-tts
一旦您从native-modules子树构建了二进制文件,请确保它们在LIBRARY_PATH(用于构建)和LD_LIBRARY_PATH(用于运行时)上可用。
安装
我强烈推荐Poetry
poetry add liepa-tts
如果必须,请使用pip
pip install liepa-tts
构建C扩展需要安装numpy,所以如果遇到错误,请首先安装它。
pip install numpy
用法
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()
注意
合成器产生的错误代码定义在include/LithUSS_Error.h
中,因此如果您需要更多关于错误的信息,请检查该文件。
您可以从这里获取数据文件和原始源代码这里
必须在data/
目录中存在的文件是
abb.txt
duom.txt
rules.txt
skaitm.txt
您应该未修改地提取语音目录。
合成器产生的.wav
文件完全未优化,包含大量静音。因此,您在使用之前应该进一步处理它。
项目详情
关闭
liepa-tts-0.1.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2809e90b0048cb1510438076db5112ace88e31d20ad6a5cc760968b8ab568bce |
|
MD5 | 9773dac70e8628d5d73d9896b6b304a8 |
|
BLAKE2b-256 | a21ebc355d671c9c9125c61f49e18d1af0bb37f424f68ea56c5c935d27ba34d5 |