参考文档
https://www.cnblogs.com/lightsalt/archive/2011/10/19/2217628.html
开源的 TTS,使用 Python 来实现文本和语音的转换。
ekho 支持 python 动态库调用
1、ekho.cpp 中添加下列代码,能够不用创建对象而调用C++方法
extern "C" {
Ekho obj;
int d_setvoice(char *text)
{
return obj.setVoice(string(text));
}
int d_speak(char *text)
{
return obj.speak(string(text));
}
int d_stop(void)
{
return obj.stop();
}
int d_pause(void)
{
return obj.pause();
}
int d_resume(void)
{
return obj.resume();
}
void d_setspeed(int tempo_delta)
{
obj.setSpeed(tempo_delta);
}
void d_setpitch(int pitch_delta)
{
obj.setPitch(pitch_delta);
}
void d_setvolume(int volume_delta)
{
obj.setVolume(volume_delta);
}
void d_setrate(int rate_delta)
{
obj.setRate(rate_delta);
}
bool d_isspeaking()
{
return obj.isSpeaking();
}
}
2、在 ./MakeFile 和./libmusicxml/linux/MakeFile 的 CXXFLAG 中增加 -fPIC -shared
3、因为 -l 参数配置错误,make 报错时手动执行。7.6 版本最终生成动态库的时候也需要这行下面代码,否则生成的执行文件无法被 python 调用。
g++ -DHAVE_CONFIG_H -I. -I./utfcpp/source -I./sonic -pthread -lstdc++ -g -O2 -O0 -MT src/ekho-ekho.o -MD -MP -MF src/.deps/ekho-ekho.Tpo -c -o src/ekho-ekho.o -shared -fPIC `test -f
Python TTS ekho库使用指南

本文档详细介绍了如何使用Python的ekho库进行文本到语音(TTS)的转换,包括C++方法的直接调用、动态库的编译与配置、以及Python测试代码示例。
最低0.47元/天 解锁文章
2372

被折叠的 条评论
为什么被折叠?



