static int save_dataset_comments (const dataset *dset) { int i, j; cst_voice *v; cst_wave *w, *fullw = NULL; flite_init(); v = register_cmu_us_kal(); j = 0; for (i=0; i<N_COMMENTS; i++) { if (dset->comments[i] != NULL) { if (j == 0) { fullw = flite_text_to_wave(dset->comments[i], v); } else { w = flite_text_to_wave(dset->comments[i], v); concat_wave(fullw, w); delete_wave(w); } j++; } } cst_wave_save_riff(fullw, "gretl_flite.wav"); delete_wave(fullw); return 0; }
static PyObject* PySemsAudioFile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { DBG("---------- PySemsAudioFile_alloc -----------\n"); PySemsAudioFile *self; self = (PySemsAudioFile *)type->tp_alloc(type, 0); if (self != NULL) { self->af = new AmAudioFile(); if(!self->af) { Py_DECREF(self); return NULL; } #ifdef IVR_WITH_TTS flite_init(); self->tts_voice = register_cmu_us_kal(); self->filename = new string(); #endif } return (PyObject *)self; }
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; }
static gboolean gst_flite_test_src_start (GstBaseSrc * basesrc) { GstFliteTestSrc *src = GST_FLITE_TEST_SRC (basesrc); src->adapter = gst_adapter_new (); src->voice = register_cmu_us_kal (); return TRUE; }
static int fl_init(char **status_info) { int ret; GString *info; log_msg(OTTS_LOG_INFO, "Module init"); *status_info = NULL; info = g_string_new(""); /* Init flite and register a new voice */ flite_init(); flite_voice = register_cmu_us_kal(); if (flite_voice == NULL) { log_msg(OTTS_LOG_ERR, "Couldn't register the basic kal voice.\n"); *status_info = g_strdup("Can't register the basic kal voice. " "Currently only kal is supported. Seems your FLite " "installation is incomplete."); return -1; } log_msg(OTTS_LOG_DEBUG, "FliteMaxChunkLength = %d\n", FliteMaxChunkLength); log_msg(OTTS_LOG_DEBUG, "FliteDelimiters = %s\n", FliteDelimiters); flite_message = g_malloc(sizeof(char *)); *flite_message = NULL; flite_semaphore = module_semaphore_init(); log_msg(OTTS_LOG_INFO, "Flite: creating new thread for flite_speak\n"); flite_speaking = 0; ret = pthread_create(&flite_speak_thread, NULL, _flite_speak, NULL); if (ret != 0) { log_msg(OTTS_LOG_ERR, "Flite: thread failed\n"); *status_info = g_strdup("The module couldn't initialize threads " "This could be either an internal problem or an " "architecture problem. If you are sure your architecture " "supports threads, please report a bug."); return -1; } module_audio_id = NULL; *status_info = g_strdup("Flite initialized successfully."); return 0; }
static void speak_dataset_comments (const dataset *dset) { int i; cst_voice *v; flite_init(); v = register_cmu_us_kal(); for (i=0; i<N_COMMENTS; i++) { if (dset->comments[i] != NULL) { flite_text_to_speech(dset->comments[i], v, "play"); } } }
ConferenceDialog::ConferenceDialog(const string& conf_id, AmConferenceChannel* dialout_channel) : conf_id(conf_id), channel(0), play_list(this), dialout_channel(dialout_channel), state(CS_normal), allow_dialout(false) { dialedout = this->dialout_channel.get() != 0; rtp_str.setPlayoutType(ConferenceFactory::m_PlayoutType); #ifdef WITH_SAS_TTS tts_voice = register_cmu_us_kal(); #endif }
static int speak_line (const char *line) { static cst_voice *v; if (v == NULL) { flite_init(); v = register_cmu_us_kal(); } if (v == NULL) return 1; flite_text_to_speech(line, v, "play"); return 0; }
static int speak_buffer (const char *buf, int (*should_stop)()) { cst_voice *v; char line[2048]; flite_init(); v = register_cmu_us_kal(); bufgets_init(buf); while (bufgets(line, sizeof line, buf)) { if (should_stop()) { flite_text_to_speech("OK, stopping", v, "play"); break; } tailstrip(line); flite_text_to_speech(line, v, "play"); } bufgets_finalize(buf); return 0; }
static void audio_graph_error (const char *msg) { #ifdef HAVE_FLITE cst_voice *v; #endif #ifdef WIN32_SAPI ISpVoice *v = NULL; HRESULT hr; #endif fprintf(stderr, "%s\n", msg); #ifdef HAVE_FLITE flite_init(); v = register_cmu_us_kal(); flite_text_to_speech(msg, v, "play"); #endif #ifdef WIN32_SAPI hr = CoInitialize(NULL); if (!SUCCEEDED(hr)) return; hr = CoCreateInstance(&CLSID_SpVoice, NULL, CLSCTX_ALL, &IID_ISpVoice, (void *) &v); if (SUCCEEDED(hr)) { wchar_t *w = wide_string(msg); ISpVoice_Speak(v, w, 0, NULL); free(w); ISpVoice_Release(v); } #endif }