Showing posts with label festival ec2 ubuntu text to speech engine how to install configure. Show all posts
Showing posts with label festival ec2 ubuntu text to speech engine how to install configure. Show all posts

Tuesday, August 5, 2008

Text To Speech Engine Festival on Ubuntu EC2

Festival:

apt-get install festival
apt-get install festvox-kallpc16k

You need to add to /usr/share/festival/festival.scm:

(define (tts_textasterisk string mode)
"(tts_textasterisk STRING MODE)
Apply tts to STRING. This function is specifically designed for use in server mode so
a single function call may synthesize the string. This function name may be added to
the server safe functions."
(let ((wholeutt (utt.synth (eval (list 'Utterance 'Text string)))))
(utt.wave.resample wholeutt 8000)
(utt.wave.rescale wholeutt 5)
(utt.send.wave.client wholeutt)))


festival.conf
-----------------------------
[general]
host=localhost
port=1314
festivalcommand=(tts_textasterisk "%s" 'file)(quit)\n

but in extensions.conf when i call the festival app i put the text
'quoted' like this:


exten => 003,1,Festival('Hello asterisk user, how are you today?') ;
<-- note the quotes ... exten => 003,2,Wait(1)

exten => 003,3,Hangup()


From the command-line type 'festival --server'
Then restart Asterisk

This configuration reads a text file (limiting it to 130 characters or less) and then speaks the message to the caller.

exten => 3200,1,ReadFile(test=/tmp/test.txt,130)
exten => 3200,n,Festival(${test})
exten => 3200,n,Hangup

Example of a Auto Attendant menu.


[MainMenu]
exten => s,1,SetVar(NUMINVALID=0)
exten => s,2,Setvar(NUMTIMEOUTS=0)
exten => s,3,Background(sales_press_one)
exten => s,4,Background(support_press_two))
exten => s,5,ResponseTimeout(5)
exten => s,6,DigitTimeout(2)

exten => t,1,SetVar(NUMTIMEOUTS=$[${NUMTIMEOUTS} + 1])
exten => t,2,Gotoif($[${NUMTRIES} < 2]?s,3)
exten => t,3,Background(vm-goodbye)
exten => t,4,Hangup()

exten => i,1,SetVar(NUMINVALID=$[${NUMINVALID} + 1])
exten => i,2,Gotoif($[${NUMINVALID} < 4]?:10)
exten => i,3,Background(invalid)
exten => i,4,Goto(s,2)
exten => i,10,Playback(vm-goodbye)
exten => i,11,Hangup()




AddThis Feed Button