bool stardict_tts_plugin_init(StarDictTtsPlugInObject *obj) { flite_init(); register_cmu_us_kal(NULL); register_cmu_time_awb(NULL); register_cmu_us_kal16(NULL); register_cmu_us_awb(NULL); register_cmu_us_rms(NULL); register_cmu_us_slt(NULL); std::string res = get_cfg_filename(); if (!g_file_test(res.c_str(), G_FILE_TEST_EXISTS)) { g_file_set_contents(res.c_str(), "[flite]\nvoice=\n", -1, NULL); } GKeyFile *keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, res.c_str(), G_KEY_FILE_NONE, NULL); gchar *str = g_key_file_get_string(keyfile, "flite", "voice", NULL); g_key_file_free(keyfile); if (str) { voice_engine = str; g_free(str); } if (!voice_engine.empty()) { now_voice = flite_voice_select(voice_engine.c_str()); } else { now_voice = flite_voice_select(NULL); } obj->saytext_func = saytext; obj->tts_name = _("Flite TTS"); g_print(_("Flite plug-in loaded.\n")); return false; }
int main(int argc, char** argv) { flite_init(); v=register_cmu_time_awb(); flite_text_to_speech("11:52 PM",v,"flite_test.wav"); printf ("Finished \n"); exit(0); }
int main(int argc, char **argv) { cst_voice *v; char thetime[1024]; char b[3]; int hour, min; cst_regex *timex; char *output = "play"; if (argc != 2) { fprintf(stderr,"usage: flite_time HH:MM\n"); exit(-1); } timex = new_cst_regex("[012][0-9]:[0-5][0-9]"); if (!cst_regex_match(timex,argv[1])) { fprintf(stderr,"not a valid time\n"); fprintf(stderr,"usage: flite_time HH:MM\n"); exit(-1); } delete_cst_regex(timex); b[2] = '\0'; b[0] = argv[1][0]; b[1] = argv[1][1]; hour = atoi(b); b[0] = argv[1][3]; b[1] = argv[1][4]; min = atoi(b); flite_init(); v = register_cmu_time_awb(NULL); sprintf(thetime, "The time is now, %s %s %s, %s.", time_approx(hour,min), time_min(hour,min), time_hour(hour,min), time_tod(hour,min)); printf("%s\n",thetime); flite_text_to_speech(thetime,v,output); return 0; }