[soundcloud url="http://api.soundcloud.com/tracks/110813303″ params="" width=" 100%" height="166″ iframe="true" /]
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-develcd /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.
Special Thanks to Our Generous Sponsors
FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.
BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.
The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.
VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
Some Recent Nerd Vittles Articles of Interest…
- Recompiling eSpeak from source with this patch will eliminate a reported file descriptor leak that could cause Asterisk to crash. [↩]
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."]
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.]
how to create ring tone