示例#1
0
void speaker::run()
{
    int heap_size = 2100000;  // default scheme heap size
    int load_init_files = 1; // we want the festival init files loaded
    festival_initialize(load_init_files, heap_size);
    festival_say_text(_string);
}
示例#2
0
bool stardict_tts_plugin_init(StarDictTtsPlugInObject *obj)
{
	festival_initialize(1, 210000);
	std::string res = get_cfg_filename();
	if (!g_file_test(res.c_str(), G_FILE_TEST_EXISTS)) {
		g_file_set_contents(res.c_str(), "[festival]\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, "festival", "voice", NULL);
	g_key_file_free(keyfile);
	if (str) {
		voice_engine = str;
		g_free(str);
	}
	if (!voice_engine.empty()) {
		std::string command = "(";
		command += voice_engine;
		command += ")";
		festival_eval_command(command.c_str());
	}
	obj->saytext_func = saytext;
	obj->tts_name = _("Festival TTS");
	g_print(_("Festival plug-in loaded.\n"));
	return false;
}
示例#3
0
void QtSpeech_proc::say(QString text) {
    try {
        if (player)
        {
            player->stop();
            delete player;
        }
        player = new WavePlayer;

        if (!init) {
            int heap_size = FESTIVAL_HEAP_SIZE;
            festival_initialize(true,heap_size);
            init = true;
        }
        has_error = false;
        EST_String est_text(text.toUtf8());
        EST_Wave est_wave;
        SysCall(festival_text_to_wave(est_text, est_wave), QtSpeech::LogicError);
        EST_String est_file(player->filePath().toUtf8());
        est_wave.save(est_file);

        connect(player, SIGNAL(finished(int)), this, SIGNAL(finished()));
        connect(player, SIGNAL(finished(int)), player, SLOT(deleteLater()));
        player->play();
    }
    catch(QtSpeech::LogicError e) {
        has_error = true;
        err = e;
    }
}
示例#4
0
int main(void)
{
    EST_Wave wave;
    int heap_size = 210000;  // default scheme heap size
    int load_init_files = 1; // we want the festival init files loaded

    festival_initialize(load_init_files,heap_size);

    //festival_say_file("/etc/issue.text");

    //festival_eval_command("(voice_msu_ru_nsh_clunits)");
    //festival_say_text("а");
    
    festival_eval_command("(voice_ked_diphone)");
    festival_say_text("privet, suchka. blyahui");

    festival_text_to_wave("hello world",wave);
    wave.save("/tmp/wave.wav","riff");

    // festival_say_file puts the system in async mode so we better
    // wait for the spooler to reach the last waveform before exiting
    // This isn't necessary if only festival_say_text is being used (and
    // your own wave playing stuff)
    festival_wait_for_spooler();

    return 0;
}
示例#5
0
	TTSFestival::TTSFestival() {
		// TODO Auto-generated constructor stub

		  festival_initialize(1,210000);
		  //festival_say_text("this is a simple test of threading situation");

		  mIsPlaying = false;
	}
void QtSpeech_th::say(QString text) {
    try {
        if (!init) {
            int heap_size = FESTIVAL_HEAP_SIZE;
            festival_initialize(true,heap_size);
            init = true;
        }
        has_error = false;
        EST_String est_text(text.toUtf8());
        SysCall(festival_say_text(est_text), QtSpeech::LogicError);
    }
    catch(QtSpeech::LogicError e) {
        has_error = true;
        err = e;
    }
    emit finished();
}
示例#7
0
extern void
voice_init()
{
  int heap_size = 2100000;
  int load_init_files = 1;

  voice_volume_set();

  festival_initialize(load_init_files, heap_size);

  // put system into async mode
  festival_eval_command("(audio_mode 'async)");

  
  festival_say_text("Hello my name is ClaraBell");

  //  fprintf(stderr, "Voice subsystem initialized\n");

}
示例#8
0
SpeechSynch::SpeechSynch() {
	festival_initialize(1,210000);
//	This must be called before any other festival functions may be called. It sets up the
//synthesizer system. The first argument if true, causes the system set up files to be loaded
//(which is normallly what is necessary), the second argument is the initial size of the Scheme heap,
//this should normally be 210000 unless you envisage processing very large Lisp structures.

	festival_eval_command("(voice_el_diphone)");
	festival_say_text("Welcome to Flying Object Madness");
//
//	festival_wait_for_spooler();

	setTrigger(Message::MSG_COL_PLAYER_LETTER);


	// Say some text;
//	festival_say_text("hello world");

}
示例#9
0
/** Helper method to initialize the text to speech lib
 */
static void tts_init(void) {
  if (!festival_initialized) {
    festival_initialize(1, 4200000);
    festival_initialized = true;
  }
}
示例#10
0
// Inicializa la librería Festival con los parámetros por defecto
// Hay que llamar a esta función antes de llamar a cualquier otra
// función de síntesis de texto.
void speech_initialize() {
	static int init=0;
	if (init) return;
	festival_initialize(true, 210000);
	init=1;
}
示例#11
0
文件: tts.cpp 项目: sub77/hobbycode
TTS::TTS()
{  
  festival_initialize(1, 210000);
}
示例#12
0
文件: tts.cpp 项目: sub77/hobbycode
TTS::TTS(const int load_init_files, const int heap_size)
{
  festival_initialize(load_init_files, heap_size);
}
void FestivalSynthesizer::initFestival()
{
    int heap_size = 210000;   // default scheme heap size
    int load_init_files = 1;  // we want the festival init files loaded

    festival_initialize(load_init_files, heap_size);

    try
    {
        const char* cfgFilename = "../config.cfg";

        Config cfg(cfgFilename);
        std::string voice = cfg.get("Voice");

        if ( voice == "female" )
        {
            festival_eval_command( "(voice_us1_mbrola)" );
            festival_eval_command( "(defvar Styles '((default 140 22 1.0)) \"Available voice styles\")" );
            festival_eval_command( "(defvar style_default 'default \"Default voice style\")" );
            festival_eval_command( "(defvar current_style 'none \"Current voice style\")" );
            festival_eval_command( "(define (Style selected_style) (let ((style (assoc selected_style Styles)))"
                                   "(if (not style) (set! style (assoc 'default Styles)))"
                                   "(let ((model_mean (cadr (assoc 'model_f0_mean  int_lr_params)))"
                                   "(model_std  (cadr (assoc 'model_f0_std   int_lr_params)))"
                                   "(new_mean (cadr style)) (new_std (cadr (cdr style)))"
                                   "(new_stretch (cadr (cdr (cdr style)))))"
                                   "(set! int_lr_params (list (list 'target_f0_mean new_mean)"
                                   "(list 'target_f0_std  new_std) (list 'model_f0_mean  model_mean)"
                                   "(list 'model_f0_std   model_std)))"
                                   "(Parameter.set 'Duration_Stretch new_stretch)"
                                   "(set! current_style (car style)) (list (car style) new_mean new_std new_stretch) ) ) )" );
            festival_eval_command( "(define (NewStyle style_name mean std stretch)"
                                   "(set! Styles (cons (list style_name mean std stretch) Styles)))" );
            festival_eval_command( "(NewStyle 'lisa 280 50 1.2)" );
            festival_eval_command( "(Style 'lisa)" );
        }
    }
    catch(const std::exception& e)
    {
        std::cerr << e.what() << std::endl;
    }

    // Check sampling rate
    EST_Wave wave;
    festival_text_to_wave( "init", wave );

    // Init pulse audio
    pa_sample_spec sample_spec;
    sample_spec.format = PA_SAMPLE_S16NE;
    sample_spec.channels = 1;
    sample_spec.rate = wave.sample_rate();

    pa_simple_ = pa_simple_new( NULL,                                   // Use the default server.
                                "FestivalSynthesizer",                  // Our application's name.
                                PA_STREAM_PLAYBACK,                     // Playback stream.
                                NULL,                                   // Use the default device.
                                "Festival Synthesizer (TalkingHead)",   // Description of our stream.
                                &sample_spec,                           // Our sample format.
                                NULL,                                   // Use default channel map
                                NULL,                                   // Use default buffering attributes.
                                NULL                                    // Ignore error code.
                                );

    if ( !pa_simple_ )
    {
        ROS_ERROR ( "Error initializing PulseAudio!" );
    }
}