跳转到主要内容

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 (50.5 kB 查看哈希值)

上传时间

支持

AWSAWS 云计算和安全赞助商 DatadogDatadog 监控 FastlyFastly CDN GoogleGoogle 下载分析 MicrosoftMicrosoft PSF赞助商 PingdomPingdom 监控 SentrySentry 错误日志 StatusPageStatusPage 状态页面