How to Install Google TTS in Freepbx

Written by admin on March 13, 2015. Posted in Applications and addons, Asterisk

Many times you need a free voice in Freepbx since voice offered by Flite engine is horrible. The other offered by Swift is good but not cheap. Google TTS offers a free but averagely good conversion on text to speech. Problem is you get bits and pieces of information to such an extenst that a novice would not be able to fit these bits together to come up with a solution.

This article seeks to show step by step how to  install Google TTS on a freepbx machine. (PLEASE NOTE the Freepbx installation referred here is on Centos 6   64bit

After you have installed your freepbx you need to login as root on ssh and do the following

1. Install google tts

yum -y install perl perl-libwww-perl sox cpan
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install mpg123
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e "install Bundle::LWP"
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e "install CGI::Util"
wget https://github.com/zaf/asterisk-googletts/blob/master/googletts.agi
mv googletts.agi /var/lib/asterisk/agi-bin/
chmod 755 /var/lib/asterisk/agi-bin/googletts.agi

cd /tmp
git clone git://github.com/zaf/asterisk-googletts
cd asterisk-goo*
cd cli
mv googletts-cli.pl /usr/local/sbin/googletts-cli.pl


2. Configure propolys-tts.agi

nano /var/lib/asterisk/agi-bin/propolys-tts.agi

 

Find

case 'swift':
exec($enginebin." -p audio/channels=1,audio/sampling-rate=8000 -o $wavefile -f $textfile");
break;

and below add

case 'googleTTS':
exec($enginebin." -l de -f $textfile -r 8000 -o $wavefile");
break;

when done the file should  be able to look like this at the portion you edited

 

case 'swift':
exec($enginebin." -p audio/channels=1,audio/sampling-rate=8000 -o $wavefile -f $textfile");
break;
case 'googleTTS':
exec($enginebin." -l de -f $textfile -r 8000 -o $wavefile");
break;
default:
}

You are done configuring google TTS but before you start using it, Go to freepbx GUI and look under Settings for Text to speech Engines

add engine and name it whatever you want. If you dont have this module make sure you install it using module admin.

 

For the engine path use

/usr/local/sbin/googletts-cli.pl

Now you can select text to speech under applications in Freepbx you will now be able to see google tts on the dropdown along with flite.

 

I hope this tutorial helps