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 

Festival TTS for Ruby

This text-to-speech engine uses Ruby and festival. Listen to the output as an mp3 sample [twittergram.com]

Prerequisites:
sudo apt-get install festival lame
sudo gem install festivaltts4r

require "rubygems"
require "festivaltts4r"
				
"I'm talking".to_speech


Reference: Festival TTS for Ruby - Make your Ruby Strings talk! [rubyforge.org]

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 );
	}
}

Text-to-speech

>>> import win32com.client
>>> s = win32com.client.Dispatch("SAPI.SpVoice")
>>> s.Speak('Hello, how are you?')

You need MS Speech SDK installed. See recipe.
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS