| speech_pm documentation | view source | Contained in the speech_pm distribution. |
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.
If you do use Speech::FileWave you may need to set up the command it uses to play sounds, see the documentation for set_play_command in Audio::FileWave.
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
Speech::Synthesiser new method.
CLASS is the name of a perl package which implements wave
playing. If not given it defaults to Audio::FileWave.
@ARGS are passed to the new method of the wave class. For
Audio::FileWave this defaults to ( "riff" ).
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.
Close down the synthesiser, releasing any resources it holds. The synthesiser may be restarted with start, but any state may have been lost.
Return a list of the voices available from this synthesiser.
Select a voice.
Returns a description of the voice.
Synthesize a description of the synthesiser,
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
Speech::Festival, Speech::Festival::Synthesiser, Audio::FileWave, perl(1), festival(1), Festival Documentation
| speech_pm documentation | view source | Contained in the speech_pm distribution. |