festvox / flite

A small fast portable speech synthesis system
Other
879 stars 190 forks source link

Built-in voice loading functions? #26

Closed teamclouday closed 5 years ago

teamclouday commented 5 years ago

Hi, I'm using flite in my linux c++ project, and I'm trying to use the built-in voice loading function

extern "C"
{
    cst_voice *cmu_us_slt(); // built in function
}

But there's a link error, should I add more link flags besides -lflite?
Also, is the function name I'm using right?

teamclouday commented 5 years ago

now I've changed the function name

extern "C"
{
    cst_voice *register_cmu_us_slt(); // built in function
}

and added compile flags -lflite -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex
the link problem fixed
but when I run the program, it shows "Error load voice: lang/lex eng not supported in this binary"
is it because I'm still missing some flags?

teamclouday commented 5 years ago

sorry, the error was because I used a downloaded flitevox file and it was incompatible
nothing wrong with the built-in functions
closing this issue

teamclouday commented 5 years ago

For any one who encountered the error "Error load voice: lang/lex eng not supported in this binary"
because of loading personal english language flitevox files
the solution is: (before the flite_voice_load function call)
in header file:

extern "C"
{
    void usenglish_init(cst_voice *v);
    cst_lexicon *cmulex_init(void);
}

in actual code:

flite_add_lang("eng", usenglish_init, cmulex_init);