liepa项目立陶宛语言合成器的python绑定
liepa-tts的Python项目详细描述
LIEPA
立陶宛语音控制服务
该项目旨在提供高品质的立陶宛数字语音服务。 免费的。 到目前为止,在不同的完整性阶段提供了几种服务, 如立陶宛语语音识别器和立陶宛语语音合成器。
这个包裹包裹住了后者。
依赖关系
要使这个包(liepa tts)工作,您需要合成器二进制文件,您将 必须自己编译。
可以获得原始源here
为了使为windows以外的平台构建二进制文件更容易,您可以 在这里获取固定源:laba-diena-tts
从本机模块子树构建二进制文件后,请确保它们是 在库路径(用于构建)和库路径(用于运行时)上可用。
安装
我强烈推荐Poetry
poetry add liepa-tts
如果必须,请使用pip:
pip install liepa-tts
您需要numpy来构建c扩展,因此如果您遇到错误,请首先安装:
pip install numpy
用法
fromliepa_ttsimportliepa# All strings must be encoded with Windows Baltic encodingENCODING="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 codeliepa.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 fileliepa.toWav(buff,"test.wav".encode(ENCODING))# Call this when you're done to free resourcesliepa.unload()
注意:
合成器产生的错误代码定义在
include/LithUSS_Error.h
如果你需要更多关于
你得到的错误检查那个文件。
您可以获取数据文件以及原始源here
必须存在于data/
目录中的文件是:
abb.txt
duom.txt
rules.txt
skaitm.txt
你应该提取未经修改的语音目录。
合成器产生的.wav
完全未优化,包含
一片寂静。因此在使用前应进一步处理。