Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

Using text-to-speech in Asterisk

Use instructions to get Asterisk to use text-to-speech. Tested on Ubuntu 8.04 Sever.

*packages required*
festival
festvox-rablp16k

file: extensions.conf
detail
exten => 3250,1,Answer()
exten => 3250,n,Festival('hello world')
exten => 3250,n,Hangup


From the command-line type 'festival --server'
Then restart Asterisk

Using Espeak

Espeak is a Text-to-speech program which I have used on Ubuntu. A sample of the audio can be found from my twittergram [twittergram.com]. Note: I made a few spelling mistakes in the audio, listen and tell me if you can hear them.

espeak -f hello_jr -s 120

Interactive Text-to-Speech (Windows, Perl)

This script calls the Windows OLE for the built in TTS. Type what you want the computer to say at the prompt and hit enter. To quit type ":q" (minus the quotation marks).


use Win32::OLE qw( EVENTS );

get_text();

sub get_text{
	$output_speech = <STDIN>;
	chomp($output_speech);
	if($output_speech ne ":q"){
		say_this();
		get_text();
	}
}

sub say_this{
	my $myTTS = new Win32::OLE( "Sapi.SpVoice" ); 
	$myTTS->Speak( "$output_speech" );
	while( $myTTS->{Speaking} )
	{
		Win32::OLE->SpinMessageLoop();
		Win32::Sleep( 100 );
	}
}
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS