-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using mimic libraries #219
Comments
Hello! Thank you for sharing this snippet! :D I'm also searching for some kind of example :'( |
I used the libraries from python. I loaded the voice from file using The libraries I needed to use were I'll see if I can do a build and figure out which lib is needed. |
This worked for me using the libraries I listed above: #include <stdio.h>
#include <unistd.h>
#include <mimic.h>
#include <lang/usenglish.h>
#include <lang/cmu_lex.h>
int main(void)
{
cst_voice *v = NULL;
mimic_init();
mimic_add_lang("eng",usenglish_init,cmu_lex_init);
mimic_add_lang("usenglish",usenglish_init,cmu_lex_init);
v = mimic_voice_select("./test.flitevox");
float durs = 0.0;
if (v)
{
printf("Hello world!\n");
mimic_text_to_speech("hello world", v, "play", &durs);
sleep(3);
}
else
{
printf("Error opening test.flitevox\n");
return 1;
}
return 0;
} If you think it would be useful I can create a repo with this and the CMakeLists.txt I used to build |
@forslund that would be great if you could do this! 😃 |
I'll clean up the code slightly and try to post it tonight or tomorrow |
@forslund -- Thank you, thank you, thank you!!! That works! I knew I was missing something simple. For me, it was the "mimic_add_lang("eng", usenglish_init, cmu_lex_init)" call that was needed and did the trick. How wonderful. A fellow coder all the way from Sweden came to the rescue. I tell you, this is an amazing time to be alive. People freely sharing computer code and donating their time to help others implement this code. And doing all this across vast distances. Truly amazing. Now I just have to try to figure out how to implement Spanish. I'm guessing if I poke around I will find language files and voice files for Spanish somewhere on the github site? You have already been so helpful, I hesitate to impose on you again, but if you know where these files are located and could point me in the right direction I would be very grateful. Thanks again! |
@zeehio did some (a lot of) work on Spanish, but the licensing was a bit of an issue so he did a big rework of mimic into a plugin based system. Check out https://github.com/MycroftAI/mimic1-full which includes Spanish support if I'm not remembering poorly. |
@2shady4u The example is now available at https://github.com/forslund/mimic1-lib-example |
The Spanish text processing was still very limited in the mimic module I wrote. Have you considered/tried other TTS systems? I believe Spanish is better supported in Festival. |
@zeehio -- I really appreciate all the help and suggestions! I had experimented with Festival in the past, but it's been long enough I can't remember why I abandoned it. I'd like for my application to be able to run on both Windows and Linux. Will Festival work on Windows? Can I build it using MinGW? I will have to research this more. These types of projects are so much easier in a Linux environment, but I'm still using Windows on my laptop. Maybe it's time for me to make that laptop dual-boot and put Linux on separate partition? Another thought I had was -- "Could I combine what was done on Festival for Spanish with Mimic1?" After all Mimic is based on Flite, which is based on Festival, right? Or are the differences too great? I'm also kind of toying with the idea of going through the exercise of actually building a language/voice. I ran across instructions on www.festvox.org. I thought that might be something fun to attempt (or will I regret it?) More likely my wife will regret it as it will take me away from household renovation projects. Lol! |
With some patience and patching it should be possible to run festival on windows. Festival embeds a SCHEME interpreter (a LISP dialect). Most of the language parsing support is written in scheme. If you want to use it in flite or mimic you would have to convert it to C, and it is not straightforward at all in my experience. Seems easier to me to work to make festival compile on windows. Be aware that all these projects come from code from the nineties written mostly by academics. Feel free to spend time wherever you enjoy it most. I did put a lot of effort some years ago and now I'm trying to find time to finish and close things, because with a young child I don't have that spare time anymore (I prefer to spend it with my family :-) ) |
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 (version 6.3.0-1) 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've also tried using mimic_voice_load() with a *.flitevox file and get the message that the file is not supported or has the wrong header?
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 starting point, but I’m just not finding anything.
The text was updated successfully, but these errors were encountered: