#!/usr/bin/perl

# CGI Script

# Text 2 Speech 2 MP3

# Requires (on Mandrake Linux 10.1) the following RPMs:
#  speech-tools
#  festival
#  perl-CGI

print "Content-type: audio/x-mp3\n\n";

use CGI;
$query = new CGI;
$text = $query->param("t");
$command = "echo $text | text2wave | lame -";

$pid = open(README, "$command |")  or die "Couldn't fork: $!\n";
while (<README>) {
 print $_;
}
close(README)
    