Friday, March 16, 2012

Asterisk Text-To-Speech Cepstral Setup


Text To Speech Integration
Cepstral + Asterisk

I've been holding onto this post for sometime, wanted to post it with some cool experiment like an IVR based story line which narrates the story and changes the story line according to choices made by listener(DTMF based and then later on Speech Recognition based).

I've now realized that due to extremely busy schedule at job and home I may not get any extra time to make a sample story; insert it into the MySQL DB; make a dialplan for it; create its web end to manage/edit stories and present it here. So instead of delivering it all in one piece its better to take a start from giving our Asterisk server a voice by installing Cepstral TTS engine.

Following are the commands to get going.

Download and Install Cepstral TTS Engine.

#wget http://downloads.cepstral.com/cepstral/i386-linux/Cepstral_Callie-8kHz_i386-linux_5.1.0.tar.gz

#tar zxvf Cepstral_Callie-8kHz_i386-linux_5.1.0.tar.gz

#cd Cepstral_Callie-8kHz_i386-linux_5.1.0

#./install.sh

Download and Install App-Swift.
App_swift is the connector between the asterisk and Cepstral engine.Swift runs from inside asterisk as an application and uses the Cepstral TTS engine running in Linux.

#cd /usr/src/

#wget http://pbxinaflash.net/source/app_swift/app_swift-1.6.2.tar.gz

#tar zxvf app_swift-1.6.2.tar.gz

#cd app_swift-1.6.2/

#make

#make install

Issue this command to let Cepstral recognize the Swift module and let it use its engine.
#echo /opt/swift/lib > /etc/ld.so.conf.d/cepstral.conf

#ldconfig

Thats it and now your TTS engine and Asterisk app_Swift connector should be ready to rock

Test Asterisk for Swift Application.
Now test Asterisk for swift application; On CLI execute the following command
Asterisk*CLI>core show application swift

You should get some long output like below:

-= Info about application 'Swift' =-

[Synopsis]
Speak text through Swift text-to-speech engine.

[Description]
Swift(text) Speaks the given text through the Swift TTS engine.
Returns -1 on hangup or 0 otherwise. User can exit by pressing any key.


Make Dialplan to speak something for you. 

exten => 1234,1,NOOP(--Starting Text-To-Speech Test--)
same => n,Answer()
same => n,Swift(Hello World This is an Asterisk server)
same => n,NoOp(Key pressed: ${SWIFT_DTMF})
same => n,Swift(You pressed ${SWIFT_DTMF}. Goodbye.)
same => n,Hangup()

exten => h,1,Hangup()


Thats all, now make your own dialplan and enjoy talking to your asterisk server. Best thing for Forever Alone guys ;)


References:
http://nerdvittles.com/?p=202 



No comments:

Post a Comment