12.12.2012 Views

Festival Speech Synthesis System: - Speech Resource Pages

Festival Speech Synthesis System: - Speech Resource Pages

Festival Speech Synthesis System: - Speech Resource Pages

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

other optional libraries such as net audio.<br />

The main external functions available for C++ users of <strong>Festival</strong> are.<br />

void festival_initialize(int load_init_files,int heapsize);<br />

This must be called before any other festival functions may be called. It sets up the synthesizer system. The<br />

first argument if true, causes the system set up files to be loaded (which is normallly what is necessary), the<br />

second argument is the initial size of the Scheme heap, this should normally be 210000 unless you envisage<br />

processing very large Lisp structures.<br />

int festival_say_file(const EST_String &filename);<br />

Say the contents of the given file. Returns TRUE or FALSE depending on where this was successful.<br />

int festival_say_text(const EST_String &text);<br />

Say the contents of the given string. Returns TRUE or FALSE depending on where this was successful.<br />

int festival_load_file(const EST_String &filename);<br />

Load the contents of the given file and evaluate its contents as Lisp commands. Returns TRUE or FALSE<br />

depending on where this was successful.<br />

int festival_eval_command(const EST_String &expr);<br />

Read the given string as a Lisp command and evaluate it. Returns TRUE or FALSE depending on where this<br />

was successful.<br />

int festival_text_to_wave(const EST_String &text,EST_Wave &wave);<br />

Synthesize the given string into the given wave. Returns TRUE or FALSE depending on where this was<br />

successful.<br />

Many other commands are also available but often the above will be sufficient.<br />

Below is a simple top level program that uses the <strong>Festival</strong> functions<br />

int main(int argc, char **argv)<br />

{<br />

EST_Wave wave;<br />

int heap_size = 210000; // default scheme heap size<br />

int load_init_files = 1; // we want the festival init files loaded<br />

}<br />

festival_initialize(load_init_files,heap_size);<br />

// Say simple file<br />

festival_say_file("/etc/motd");<br />

festival_eval_command("(voice_ked_diphone)");<br />

// Say some text;<br />

festival_say_text("hello world");<br />

// Convert to a waveform<br />

festival_text_to_wave("hello world",wave);<br />

wave.save("/tmp/wave.wav","riff");<br />

// festival_say_file puts the system in async mode so we better<br />

// wait for the spooler to reach the last waveform before exiting<br />

// This isn't necessary if only festival_say_text is being used (and<br />

// your own wave playing stuff)<br />

festival_wait_for_spooler();<br />

return 0;<br />

[ < ] [ > ] [ > ] [Top] [Contents] [Index] [ ? ]<br />

28.5 C only API

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!