Speech::Synthesiser - Generic speech syntheiser interface
use Speech::Synthesiser; $synth = new Speech::Synthesiser -type => 'SynthName', # other args ; start $synth; stop $synth; @voices = voice_list $synth; voice $synth "myvoice"; intro $synth; speak $synth $text;
Speech::Synthesiser provides a simple way to add speech to a perl application. It is a generic class which can be used to talk to any speech synthesiser given a suitable interface module.
Actual sound output is provided by an auiliary class, by default Audio::FileWave which runs an external program to play sound, but you can replace it with another class if you have a better way of playing sounds (eg a perl extension providing sound output), see the documentation for Speech::FileWave for the interface an alternative should provide should implement.
- $synth = new Speech::Synthesiser -type => 'SynthName', ARGS;
Create a synthesiser of the named type. Looks for a package
Speech::SynthName::Synthesiser. All arguments are passed to the creation function for that class.
The following arguments have special meaning to the
- start $synth;
Do whatever is ncecessary to prepar ethe synthesiser fo work. Returns true if all is well, false otherwise. In the event of an error the variable $synth_error conatains a description of it.
- stop $synth;
Close down the synthesiser, releasing any resources it holds. The synthesiser may be restarted with "start", but any state may have been lost.
- @voices = voice_list $synth;
Return a list of the voices available from this synthesiser.
- voice $synth "myvoice";
Select a voice.
- voice_description $synth;
Returns a description of the voice.
- synth_description $synth;
Synthesize a description of the synthesiser,
- speak $synth $text;
Speak the given text. Not much more to be said really:-).
The following should talk to you, all else being equal. Uses the festival synthesiser, so you will need to run a festival server on the named machine.
use Speech::Synthesiser; $synth = new Speech::Synthesiser -type => 'Festival', -host => 'festival-server.mynet'; start $synth || die "can't talk to festival - $synth_error"; speak $synth "We are perl, prepare for assimilation.";
Richard Caley, R.Caley@ed.ac.uk