Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Chatterbox to Festival Server (TTS output)

by planetscape (Canon)
on Jul 13, 2005 at 04:48 UTC ( #474456=note: print w/ replies, xml ) Need Help??


in reply to Chatterbox to Festival Server (TTS output)

Thank you, atcroft!

Because I run WinXP and had trouble installing Festival under Cygwin, I modified this (slightly) to use Microsoft Direct Speech Synthesis (part of the Microsoft Speech API). My modifications were based largely on code found here, and of course, lots of assistance from, and hand-holding by, atcroft himself. (Thanks again!)

(99.99% of this is still atcroft's work, and he deserves the credit.)


#!/usr/bin/perl # by [atcroft] - from [id://465955] # *minor* mods by [planetscape], based largely on code found here: # http://www.windowsitpro.com/WindowsScripting/Article/ArticleID/20796 +/20796.html # CB2Speech.pl use strict; use warnings; use LWP::Simple; use XML::Simple; use Win32::OLE qw( EVENTS ); my $DirectSS = new Win32::OLE( "{EEE78591-FE22-11D0-8BEF-0060081841DE} +" ); Win32::OLE->WithEvents( $DirectSS, \&ProcessEvents, "{EEE78597-FE22-11 +D0-8BEF-0060081841DE}" ); my $fSpeaking; $| = 1; my $delay = 90; my $seen = 0; my ($max_retrievals); { my %to_run = ( days => 0, hours => 0, minutes => 30, seconds => 0, ); $max_retrievals = int( ( ( ( $to_run{days} * 24 + $to_run{hours} ) * 60 + $to_run{minutes} ) * 60 + $to_run{seconds} ) / $delay ); } my $display_messages = 0; my $xs = new XML::Simple; my $cb_xml_url = q{http://www.perlmonks.org/index.pl?node_id=207304}; my $format = sprintf( qq{(%%0%dd) %%s - %%s: %%s\n}, length($max_retrievals) ); print length($max_retrievals), " ", $max_retrievals, "\n"; while ($max_retrievals) { my $said = 0; my $cb_xml = get($cb_xml_url) or die (qq{Could not retrieve CB XML ticker: $!\n}); my $ref = $xs->XMLin( $cb_xml, ForceArray => [q{message}] ) or die (qq{Could not parse CB XML: $!\n}); if ( exists( $ref->{message} ) ) { foreach my $message ( @{ $ref->{message} } ) { if ( $message->{message_id} > $seen ) { $seen = $message->{message_id}; my $Phrase = (join ( qq{\t}, $message->{author}, $message->{text} ) . qq{\n} ); $DirectSS->Speak( $Phrase ); $fSpeaking = 1; while( $fSpeaking ) { Win32::OLE->SpinMessageLoop(); Win32::Sleep( 100 ); } $said++; printf $format, $max_retrievals, scalar localtime $message->{epoch}, $message->{author}, $message->{text} if ($display_messages); } } print qq{Said: $said\n} if ($display_messages); } $max_retrievals--; sleep($delay); } sub ProcessEvents { my( $Obj, $Event, @Args ) = @_; if( 4 == $Event ) { $fSpeaking = 0; } }
planetscape


Comment on Re: Chatterbox to Festival Server (TTS output)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://474456]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-07-10 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls