TTS (Text to Speech)

From KlavoWiki
Jump to navigationJump to search

TTS; Short for text-to-speech, a form of speech synthesis that converts text into spoken voice output. TTS systems were first developed to aid the visually impaired by offering a computer-generated spoken voice that would "read" text to the user.

Festival

Festival is a Linux TTS application that is used with an Asterisk application called Festival. The voice from Festival is pretty raw and is very synthesised. It's free and it does work.

Installation

To install festival is quite easy. It is just a matter of using the CentOS repository.

yum install festival

Configuration for Asterisk

Once Festival is installed you need to edit the following file and make the required changes.

/usr/share/festival/festival.scm
Add the following contents to the end of the file but place it above the last line.

;;; Command for Asterisk begin 
(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." 
      (utt.send.wave.client (utt.wave.resample (utt.wave.rescale (utt.synth  
                    (eval (list 'Utterance 'Text string))) 5) 8000))) 
;;; Command for Asterisk end

Find the line defvar server_access_list and change the localhost settings with the following.
Make sure to change the line hostname.mydomain.com with the FQDN of the server.

'("localhost\\.localdomain" "localhost" "hostname.mydomain.com")

Starting Festival

From the Linux CLI runn the following command to run Festival. From here you can see any errors that occur. Once Festival is working it can be placed in the startup file. You will need to have 2 sessions active. One for the Festival sessions and one for Asterisk. This will allow you to see both sides for any errors.

/usr/bin/festival --server

Starting Festival at Startup

Edit the file /etc/rc.d/rc.local and add the following line.
/etc/rc.d/rc.local

/usr/bin/festival --server &

Using Festival

;Festival Test
exten => 99,1,Answer()
exten => 99,n,Festival(Hello.  My name is festival voice)
exten => 99,n,Festival(You dialled number ${EXTEN})
exten => 99,n,Festival(Goodbye)
exten => 99,n,Hangup

NeoSpeech

NeoSpeech is a TTS appliction that is much more fluid than Festival. NeoSpeech can be purchased from NextUp for under AU$50.