Problem using libraries, registering a voice

My end-goal is to incorporate the TTS libraries into my own application to help me practice my Spanish listening skills. I would like this application to work on both Linux and Windows.

I have downloaded and compiled the source code for Mimic Classic on my Linux box (Linux Mint 18). The standalone version (version mimic-1.3.0.2) runs fine from a console window. I have also “cross-compiled” the source for Windows and “distributed” it per the instructions. The standalone version also runs fine on my Windows laptop (Windows 7) from a command prompt.

Now my next step is to link the libraries into my own source code and use the API to generate TTS from within my own application. I am using code::blocks IDE and MinGW G++ compiler on both Linux and Windows. Everything seems to compile except when it comes to registering a voice. I’m trying to use register_cmu_us_slt(), but I get an undefined reference. I am linking in the libttsmimic_lang_cmu_us_slt.a library, which I’m sure contains this routine, but it’s not resolving it. It does the same thing on both Linux and Windows. I must be doing something stupid, but I can’t identify the problem. So any help would be greatly appreciated! Here’s my code (same on both Linux and Windows):

#include
#include “mimic.h”

using namespace std;

extern cst_voice *register_cmu_us_slt(const char *voxdir);

int main()
{
cst_voice *v = NULL;
float durs = 0.0;
int err;

if ((err = mimic_init()))
    cout << "error initializing mimic (" << err << ")\n";
v = register_cmu_us_slt(NULL);
if ((err = mimic_text_to_speech("hello world", v, "play", &durs))) {
    if (err == -EINVAL)
       cout << "mimic_text_to_speech invalid parameter (-EINVAL)\n";
    else if (err == -EINTR)
        cout << "mimic_text_to_speech error processing output (-EINTR)\n";
}

cout << "Hello world!" << endl;
if ((err = mimic_exit()))
    cout << "error exiting mimic (" << err << ")\n";

return 0;

}

Or should I be using “mimic_voice_select()” instead of “register_cmu_us_slt()”? I’ve tried using “mimic_voice_select(“slt”)”, but it still returns an invalid pointer to an object of type “cst_voice”.

I’m just lost. Not sure what to try next. Any help would be greatly appreciated. Then, of course, once I get this working I will need to switch to using Spanish language instead of English.

I’ve searched for some sample code to use as a template, but I’m just not finding anything.

Hi Bob, welcome to the forums.

I haven’t seen anyone try to integrate Mimic1 directly into their application and I’m not familiar with the internals of Mimic1 myself.

Your best bet would be to open an issue on the repo itself - it’s more likely to be seen by the original authors and others working on the code.

Thank you! I appreciate your quick response. I will do as you suggest and open an issue on the “repo”, but I’m not sure what you mean by “repo”? Is that another website or github? Sorry, I’m just an old geezer not familiar with a lot of the terminology used on these forums. Thanks again!

Ah sorry, it’s short for repository in this case on Github. In short, head here:

Thanks for your patience! I submitted an “issue” on GitHub. I had a devil of a time signing up for an account! Couldn’t get the dice to add up to 14 and pass the captcha. Finally had to resort to the audible test.

I’m kind of surprised no one else has incorporated the libraries into their own applications? I sort of expected that was the whole idea behind sharing the source code?

I hope I can get it to work. It seems like a really nice package and the developers have put a lot of effort into it. Anyway, thanks again for your help!

Solved: A very nice person from Sweden (username “forslund”) fixed me up. I was missing a call to mimic_add_lang(“eng”, usenglish_init, cmu_lex_init) added after mimic_init(). And then I selected the “cmu_us_slt.flitevox” file using the mimic_voice_select() call. That did the trick. Here’s a link on the gitHub website with a sample of working code:

Now, I just have to figure out how to switch from English to Spanish. Almost there. Thanks again for your help!

1 Like