首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >windows上的Flite API错误

windows上的Flite API错误
EN

Stack Overflow用户
提问于 2018-08-23 14:57:25
回答 1查看 127关注 0票数 1

我为windows构建flite,代码是:

代码语言:javascript
复制
#include "..\\include\\flite.h"
cst_voice *register_cmu_us_kal();
int main(int argc, char **argv)
{    cst_voice *v;
    if (argc != 2)
    {
        fprintf(stderr, "usage: flite_test FILE\n");
        exit(-1);
    }
    flite_init();
    v = new_voice();
    flite_text_to_speech("This is a test",v,"play");
    return 0;
}

但是我得到了printf信息"usage:",如果我删除它,我会得到这个“尝试访问-1 \f25 val flite-1\f6类型中的词典”。我使用的是windows,所以我在调用project.exe时没有使用文档中的参数。你知道怎么解决这个问题吗?

EN

回答 1

Stack Overflow用户

发布于 2018-08-23 15:43:35

正如注释中所说,您应该删除参数计数(argc)检查。

另外:当你调用new_voice方法时,你得到的是未初始化的cst_voice,并且你仍然不能使用它。

这就是你得到这个错误的原因:

尝试访问-1 \f25 val类型中的词典

这意味着cst_voice结构中的lex (cst_lexicon)仍未初始化。

我猜您需要执行类似以下代码的操作:

代码语言:javascript
复制
cst_voice *register_cmu_us_no_wave()
{
    cst_voice *v = new_voice();
    cst_lexicon *lex;

    v->name = "no_wave_voice";

    /* Set up basic values for synthesizing with this voice */
    usenglish_init(v);
    feat_set_string(v->features,"name","cmu_us_no_wave");

    /* Lexicon */
    lex = cmu_lex_init();
    feat_set(v->features,"lexicon",lexicon_val(lex));

    /* Intonation */
    feat_set_float(v->features,"int_f0_target_mean",95.0);
    feat_set_float(v->features,"int_f0_target_stddev",11.0);

    feat_set_float(v->features,"duration_stretch",1.1); 

    /* Post lexical rules */
    feat_set(v->features,"postlex_func",uttfunc_val(lex->postlex));

    /* Waveform synthesis: diphone_synth */
    feat_set(v->features,"wave_synth_func",uttfunc_val(&no_wave_synth));

    return v;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51979973

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档