AGI, Text to Speech

I can’t figure out how to make this system talk.

Is there a command that can take text and speak it? Either a EXEC command like: Dial, or an AGI/FastAGI command?

So far I found something that will speak each letter but not words, and something else that sounds out each letter as a word.
Eel -> elephant, elephant, leaf

So I was trying to figure this out. Instead I thought maybe I can do Text to Speech using Microsoft SAPI, save it as a wave file, then play the wave file, StreamFile

But that didn’t work either, it would never play. I wasn’t sure if the file had to be on the windows system or on the asterisk box itself, i tried both locations and it wont stream anything… im trying wave files…

Please help

please help me, pretty please =)

have you looked at festival? AAH has an example feature that downloads the weather forecast (from NY but easily changed) and then reads it out through the festival text to speech engine which basically generates a wav file that is then streamed back out. If I recall correctly, you need to make sure to use the EAGI call if you will be streaming. Festival doesn’t have the greatest sound, there are commercial substitutes that aren’t too expensive and sound a lot better, but …

you can get the details form AAH but the guts of it is one PERL script which parses each line making the folowing call:


and then the creates the wav file to be read back out:


#make a tts dir inside your sounds dir (as specified below)
#adjust the t2wp variable to point to your festival bin directory

use Asterisk::AGI;
use File::Basename;
use Digest::MD5 qw(md5_hex);

$AGI = new Asterisk::AGI;

my %input = $AGI->ReadParse();
my ($text)=@ARGV;
my $hash = md5_hex($text);
my $sounddir = “/var/lib/asterisk/sounds/tts”;
my $wavefile = “$sounddir/”.“tts-$hash.wav”;
my $t2wp= “/usr/bin/”;

unless (-f $wavefile) {
open(fileOUT, “>$sounddir”."/say-text-$hash.txt");
print fileOUT “$text”;
my $execf=$t2wp.“text2wave $sounddir/say-text-$hash.txt -F 8000 -o $wavefile”;

Well I can get festival to work, but the quality is very very very poor.

base.Exec(“AGI”, “|Hello World!”);
this works…

Maybe there is another TTS script or program built into Asterisk that works like festival does, but I don’t know where it is.

So there are 4 other choices as I see it, which are all TTS applications/scripts/code which can convert to a wave file.

However, I can’t get this to work:
base.Exec(“Playback”, “/var/lib/asterisk/moh-native/fpm-sunshine.wav”);
both of these do nothing.

fpm-sunshine has a chmod of 755, and the owner and group is asterisk.

Very Verbose shows the AGI commands but nothing more, no errors or anything.

Text->Wave Options:
Microsoft SAPI, then upload the file to the Asterisk Box
maybe some third party TTS

Even if I do convert it to a wave file, I can’t get it to play.

I’m using .Net 2, Asterisk .NET, Please please please help


Could someone please help me out=) ?

haven’t played much with generating wav files, but take a look at this link as it discussed what formats Asterisk likes and how to do conversions.

btw - I pulled this up with Google: ‘asterisk playback format’ top hit: … n+Asterisk