NAME

Speech::Synthesis - A generic interface for different Text To Speech Engines

VERSION

This is Speech::Synthesis 0.01

SYNOPSIS

use Speech::Synthesis;

my $foo = Speech::Synthesis->new();
...

CLASS METHODS

@engines = Speech::Synthesis->InstalledEngines()

This class method returns a list of installed Speech Engines. Depending on your platform, it may return one or more of the following:

'MSAgent' (Win32 only)
'SAPI4' (Win32 only)
'SAPI5' (Win32 only)
'MacSpeech' (OS X only)
'Festival' (Not implemented yet)

@langs = Speech::Synthesis->InstalledLanguages(engine => $engine)

This method queries the installed languages for the specified engine (see 'InstalledEngines'). The data that is returned uses the ISO 3166-1 conventions. This specification uses a two-letter, capitalized code to identify a specific country. By catenating a language designator with an underscore character and a regional designator, you get a designator that identifies the locale for a specific language and country. It could return a list like ('en_US', 'en_GB', 'fr_CA', 'nl_NL').

@voices = Speech::Synthesis->InstalledVoices(%options)

This method queries the installed voices for the Speech Synthesis object. You can supply one or more options, which will have a filtering effect on the returned voices. These options are:

engine

This takes an engine name as used in InstalledEngines (mandatory).

language

This takes one or more of the language values as returned by InstalledLanguages()

gender

This parameter can be one of the following: 'male', 'female' or 'neutral'.

The voices array that this method returns is an array of hashrefs. Each hashref contains at least the following keys: 'id', 'name', 'description', 'language', 'gender', 'age'. It may return more keys, depending on what the selected engine supports. If a key has an undefined value, it simply isn't available.

@avatars = Speech::Synthesis->InstalledAvatars(engine => $engine)

This class method currently only works for the 'MSAgent' engine (so that's the only value for the $engine that will actually return anything), and it will return a list of avatars (MS Agent Characters) that are currently installed.

INSTANCE METHODS

$ss = Speech::Synthesis->new(%options)

This is the constructor. Parameters can be supplied using key/value combinations. Valid parameters are:

engine

The value for the 'engine' key can be one of the speech engine values described in the InstalledEngines class method.

voice

The value of the 'voice' key can be one of the 'id' values as defined in the array of hashrefs that the InstalledVoices method returns.

language

This parameter is mandatory when you specify 'MSAgent' as the engine. It will be ignored otherwise

avatar

This parameter is mandatory when you specify 'MSAgent' as the engine. It will be ignored otherwise. It is the avatar (or Agent Character) that will show up on your desktop and "speak" the text for you. It might be used for other engines in the future.

async

This parameter defines wether we will wait until speaking finishes or not. By default, async = 1. If you want your code to wait until it finishes speaking, set it to 0. (not supported for MSAgent)

$o = $ss->getobject()

This method returns the original Perl object that the Speech::Synthesis module uses at that very moment. It doesn't support Mac::Speech (since that module doesn't use objects)

$ss->voice($id)

This method gets or sets the id of the voice. This is the same 'id' as used in the voices array of hashrefs in the InstalledVoices method.

$ss->speak($string)

This method speaks the $string using the selected engine and the selected voice.

BUGS AND CAVEATS

The working of asynchronous speecht doesn't really work yet. It seems to work for SAPI5 only. Festival support is being worked on.

AUTHOR

Jouke Visser, <jouke@pvoice.org>

BUGS

Please report any bugs or feature requests to bug-speech-synthesis@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Speech-Synthesis. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005 Jouke Visser, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.