Fall Festivus: Asterisk Text-to-Speech Roundup with a Baker’s Dozen New Voices

It’s been a while since we looked at the text-to-speech (TTS) landscape with Asterisk®. So we thought we’d bring you up to date on where we stand with text-to-speech in the free department insofar as Asterisk 11 is concerned. The hands-down winner remains Lefteris Zafiris’ implementation of Google TTS. It rivals any commercial TTS software application and costs you nothing. The good news is, if you’re running Incredible PBX 11, you already have it. For other PBX in a Flash systems, start with our previous Nerd Vittles tutorial to get Google TTS installed. For other systems, start with the Lefteris Zafiris tutorial. Once everything is installed, copy the perl script to /usr/local/sbin and make a temporary directory to hold your Google TTS recordings:

cp /var/lib/asterisk/agi-bin/googletts-cli.pl /usr/local/sbin/googletts-cli.pl
mkdir /tmp/tts
cd /tmp/tts

For each recording you wish to create, use the following syntax where hello.wav is the name for your new file and “Hello world” is the text you wish to convert to a sound file:

googletts-cli.pl -o hello.wav -l en -t "Hello world"

Next, convert the .wav file into a .gsm file that is compatible with Asterisk and move it into place for use with Asterisk:

sox hello.wav -r 8000 -c1 hello.gsm
mv hello.gsm /var/lib/asterisk/sounds/custom

To convert the file into an MP3 for your cellphone or a silly web site like ours, it goes like this:

lame -h -b 64 "hello.wav" "hello.mp3"

Now you can use the recording in your Asterisk dialplan like this:

exten => 1234,n,Playback(custom/hello)

To use the recorded voice prompts in FreePBX®, you first must copy them to your desktop computer. Then, in FreePBX, choose Admin -> System Recordings. Pick the file on your desktop and click Upload. Give the recording a name and then click Save. The recordings then are available for use in your IVRs, Ring Groups, and Announcements.

To create Google TTS prompts on-the-fly in your dialplan, use the following syntax:

exten => 1234,n,agi(googletts.agi,"Hello world.")

If you need help, take a look at PIAF Forum thread covering Google TTS and build some terrific applications for you and your customers. It’s the ultimate freebie!



Today we also want to explore what else is out there besides Flite and Google TTS. Festival and its little brother, Flite, have been staples of the PBX in a Flash and Incredible PBX projects since the outset. The problem has always been the lack of voices. The good news is that now there are at least some choices with Festival. To use these new voices with Asterisk in PBX in a Flash and Incredible PBX, you’ll first need to crank up Festival. From the command prompt, type: festival –server &. If you’d prefer to start up Festival when your server boots, then issue the following command and reboot:

echo "festival --server &" >> /etc/rc.d/rc.local

To download and install the new voices, we’ll need the RPMForge repository. If you’re using a 32-bit system, issue the following commands to activate it:

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
rpm -Uvh rpmforge*
sed -i 's|enabled = 0|enabled = 1|' /etc/yum.repos.d/rpmforge.repo

If you’re running a 64-bit system, issue the following commands:

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -Uvh rpmforge*
sed -i 's|enabled = 0|enabled = 1|' /etc/yum.repos.d/rpmforge.repo

Now let’s add some voices to your server. You can find out what’s available by issuing one of the following commands:

yum search festvox
yum search festival

To install some new voices for you to play with, issue the following commands:

yum -y install festvox-rms-arctic-hts.noarch
yum -y install festvox-kal-diphone.noarch
yum -y install festvox-ked-diphone.noarch
yum -y install festvox-jmk-arctic-hts.noarch
yum -y install festvox-clb-arctic-hts.noarch
yum -y install festvox-awb-arctic-hts.noarch
yum -y install festvox-bdl-arctic-hts.noarch
yum -y install hispavoces-pal-diphone.noarch
yum -y install hispavoces-sfl-diphone.noarch

For a list of your installed voices for Festival, issue the following command:

echo "(voice.list)" | festival --interactive

  • kal_diphone
  • ked_diphone
  • nitech_us_clb_arctic_hts
  • nitech_us_jmk_arctic_hts
  • nitech_us_slt_arctic_hts
  • nitech_us_rms_arctic_hts
  • nitech_us_bdl_arctic_hts
  • nitech_us_awb_arctic_hts
  • JuntaDeAndalucia_es_sf_diphone
  • JuntaDeAndalucia_es_pa_diphone

To use Festival voices in your dial plan, you’ll need the name of the voice you wish to use with a prefix of voice_. So, for example, the kal_diphone voice would be voice_kal_diphone. You can control the volume of the voice prompts by (gradually) adjusting the scale. Then the dialplan syntax looks like this:

exten => 1234,n,System(echo "Hello." | text2wave -eval "(voice_kal_diphone)" -scale 1.0 -F 8000 -o /tmp/${UNIQUEID}.wav)
exten => 1234,n,Playback(/tmp/${UNIQUEID})
exten => 1234,n,System(rm -f /tmp/${UNIQUEID}.wav)



We have a third option for you today. eSpeak for Asterisk is brought to you by none other than Lefteris Zafiris. If you haven’t already figured it out, Lefteris has single-handedly kept Asterisk text-to-speech humming along for years. We all owe him our deepest appreciation. Thank you, Lefteris!

eSpeak is a terrific TTS platform because it supports literally dozens of foreign languages. It’s still hard for some Americans to grasp the idea that the whole world doesn’t speak English so here’s an app for the Restivus. Lefteris is a Debian devotee so it takes a little elbow grease to get this one going on the CentOS platform with PBX in a Flash or Incredible PBX. If you can cut-and-paste commands, then this shouldn’t be too difficult; however, we don’t recommend this version for production use.1 After logging into your server as root, make certain that you’ve enabled the RPMForge repo as explained above. Then issue the following commands to install eSpeak and eSpeak for Asterisk:

yum -y install portaudio-devel
yum -y install libsndfile-devel
yum -y install libsamplerate-devel
yum -y install espeak
yum -y install espeak-devel

cd /usr/src
git clone git://github.com/zaf/Asterisk-eSpeak
cd Asterisk-eSpeak
make
make install
make samples
cd /etc/asterisk
mv espeak.conf espeak.conf.orig
wget http://incrediblepbx.com/espeak.conf
chown asterisk:asterisk *.conf
amportal restart

Once eSpeak is loaded, the dialplan syntax for eSpeak TTS looks like this:

exten => 1234,n,Espeak("Welcome to the new world.",any,en-us)
exten => 1234,n,Espeak("Bienvenido al nuevo mundo.",any,es-la)

For the list of eSpeak language abbreviations, issue the following command: espeak --voices.

So… where do we go from here? Hopefully, MBROLA and Festival MBROLA are next in line. The Debian methodology has already been documented. Who would like to tackle a CentOS tutorial?



Important Final Step. Once you’ve finished installing your new TTS apps and voices, don’t forget to turn off the RPMForge repo. There are many apps in the repo that will do irreparable damage to your PBX in a Flash server if it attempts to update a component from the wrong repository! Just issue the following command to disable the RPMForge repo until you need it again. Enjoy!

sed -i 's|enabled = 1|enabled = 0|' /etc/yum.repos.d/rpmforge.repo



Deals of the Week. There’s still an amazing deal on the street, but you’d better hurry. A new company called Copy.com is offering 20GB of free cloud storage with no restrictions on file size uploads (which are all too common with other free offers). Copy.com has free sync apps for Windows, Macs, and Linux systems. To take advantage of the offer, just click on our referral link here. We get 5GB of extra storage which will help avoid another PIAF Forum disaster.

Originally published: Tuesday, September 17, 2013




Need help with Asterisk? Visit the PBX in a Flash Forum.


 

We are pleased to once again be able to offer Nerd Vittles’ readers a 20% discount on registration to attend this year’s 10th Anniversary AstriCon in Atlanta. Here’s the Nerd Vittles Discount Code: AC13NERD.


 
New Vitelity Special. Vitelity has generously offered a new discount for PBX in a Flash users. You now can get an almost half-price DID from our special Vitelity sign-up link. If you’re seeking the best flexibility in choosing an area code and phone number plus the lowest entry level pricing plus high quality calls, then Vitelity is the hands-down winner. Vitelity provides Tier A DID inbound service in over 3,000 rate centers throughout the US and Canada. And, when you use our special link to sign up, the Nerd Vittles and PBX in a Flash projects get a few shekels down the road while you get an incredible signup deal as well. The going rate for Vitelity’s DID service is $7.95 a month which includes up to 4,000 incoming minutes on two simultaneous channels with terminations priced at 1.45¢ per minute. Not any more! For PBX in a Flash users, here’s a deal you can’t (and shouldn’t) refuse! Sign up now, and you can purchase a Tier A DID with unlimited incoming calls for just $3.99 a month. To check availability of local numbers and tiers of service from Vitelity, click here. Do not use this link to order your DIDs, or you won’t get the special pricing! Vitelity’s rate is just 1.44¢ per minute for outbound calls in the U.S. There is a $35 prepay when you sign up. This covers future usage and any balance is fully refundable if you decide to discontinue service with Vitelity.
 


Some Recent Nerd Vittles Articles of Interest…

Be Sociable, Share!

  1. Recompiling eSpeak from source with this patch will eliminate a reported file descriptor leak that could cause Asterisk to crash. []

3 Responses to “Fall Festivus: Asterisk Text-to-Speech Roundup with a Baker’s Dozen New Voices”

  1. MisterQ says:

    Slight Technical Correction – The writeup says that “The good news is, if you’re running Incredible PBX 11, you already have it.” I am taking it, that IncrediblePBX 11 equates to the most recent Incredible Pi that I installed just a few days ago.

    There are a couple of required parts to this /var/lib/asterisk/agi-bin/googletts.agi (which is where it is expected), and var/lib/asterisk/agi-bin/googletts-cli.pl which then gets copied to another directory. It would appear that in the Pi distribution, this second file wasn’t included – it isn’t in this directory, or the ultimate destination directory. One needs to go to Zafiris’ distribution kit to get a copy.

    [WM: Thanks. I'll add it to "the list."]

  2. MisterQ says:

    While a lot of the tradition of PIAF is based around Centos, and noting that “Mister TTS” (Zaf) is a Debian devotee, I also note that Incredible Pi is, of course, on a debian platform and as such a number of things arent there by default (such as yum – which is part of most of the installs (of Festival etc). Can one safely assume that one can just install yum on one’s PI, and all will work – or not…

    [WM: That'd be a NOT. Sorry.]

  3. rajendra says:

    how to create ring tone

Leave a Reply

Ringbinder theme by Themocracy