SPUG: Festival speech synthesis and perl

David Vergin dvergin at igc.org
Sat Jul 2 00:07:49 PDT 2005


James Moore wrote:
> ...using the Festival server from Perl?  If so, what are you doing to talk
> to the server?

This example talks to Festival in scheme. The scheme bit could, of 
course be more extended. Note the change from '--tts' to '--pipe' on the 
pipe to /usr/bin/festival as compared to the simpler example I posted a 
few minutes ago.

my @voices = qw( voice_rab_diphone
                  voice_don_diphone
                  voice_kal_diphone
                  voice_ked_diphone
                );
my $voice = $voices[ rand @voices ];
my $text = 'Some text';
open( FESTIVAL, '| /usr/bin/festival --pipe' )
    or die "\nCan't open pipe to festival: $!\n\n";
print FESTIVAL "($voice) (SayText \"$text.\")\n";
close FESTIVAL;

Looking at it now, that print line would probably look a little better 
as something like (untested):

   print FESTIVAL qq/($voice) (SayText "$text.")\n/;

Regards,
David


More information about the spug-list mailing list