0

我最近一直在尝试在我的一个项目中使用 Flite 文本到语音系统(2.0),当我调用flite_text_to_speech()程序退出时出现以下消息:

VAL: tried to access lexicon in -1 type val

我根据此处找到的 Flite 文档中提供的代码制作了一个小型测试程序:

/* File: test.cpp */
#include <flite.h>

int main(int argc, char **argv)
{
    cst_voice *v;
    flite_init();
    v = new_voice();
    flite_text_to_speech("This is a test",v,"play");
    return 0;
}

这可以干净地编译:

g++ -Wall -g -o flite_test test.cpp -I/usr/local/include/flite -lflite_cmu_us_kal -lflite_usenglish -lflite_cmulex -lflite -lasound -lm

但是,当我运行 ./flite-test 时,我仍然得到同样的错误:

VAL: tried to access lexicon in -1 type val

这是 Flite 中的错误还是我在这里做了一些愚蠢的事情?我知道 Flite 2.0 相对年轻,所以我正在考虑使用旧版本,但我更愿意使用最新版本。我的测试代码是否适用于任何人,如果可以,我应该做些什么不同的事情?

更新:我刚刚用 Flite 1.4 尝试了这个,同样的事情发生了。

4

1 回答 1

1

I studied the flite utility's source and I was able to solve my issues by copying heavily from its main function in flite_main.c.

于 2015-02-10T22:21:06.140 回答