源码:https://github.com/festvox/flite
使用文档:http://www.festvox.org/flite/doc/flite_7.html#C-example
示例代码:
#include "flite.h"
cst_voice *register_cmu_us_kal(const char *voxdir); // 注意这一行和官方文档不同,官方文档的会报错。int main(int argc, char **argv)
{
cst_voice *v;if (argc != 2)
{
fprintf(stderr,"usage: flite_test FILE\n");
exit(-1);
}flite_init();
v = register_cmu_us_kal(NULL);
flite_file_to_speech(argv[1],v,"play");
}
静态编译(Ubuntu 22.04下不行):
gcc -Wall -g -o flite_test flite_test.c -Iinclude build/x86_64-darwin21.6.0/lib/*.a
动态编译:
Ubuntu 22.04下编译flite是需要加上--enable-shared参数:
./configure --enable-shared
make
gcc -Wall -g -o flite_test flite_test.c -Iinclude -Lbuild/x86_64-linux-gnu/lib -lasound -lm -lflite -lflite_cmu_us_kal
评论