Sprachsynthese

Manchmal wäre es ganz hilfreich sich von der Asterisk etwas vorlesen zu lassen, beispielsweise eingegangene E-Mails oder den System-Status. Asterisk sieht hierfür "Festival" (The Festival Speech Synthesis System) vor.

Festival

Unter Debian ist die Installation wie immer denkbar einfach: "apt-get update; apt-get install festival" installiert festival, festlex-cmu, festlex-poslex und festvox-kallpc16k.
Festival installiert sich als Server und öffnet dabei einen Port auf dem es lauscht. Da das potenziell eine Sicherheitslücke sein könnte, ist in Debian das Start-Skript /etc/init.d/festival so abgeändert, dass Festival nicht startet. Wer weiß, was er tut, muss in Zeile 9 das "exit 0" raus nehmen.
Anschließend muss man die Konfigurationsdatei /etc/festival.scm noch ein wenig anpassen.

/etc/festival.scm

;; Enable access to localhost (needed by debian users)
(set! server_access_list '("localhost\.localdomain" "localhost"))

;;; 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

Festival Server starten

Jetzt kann man den Festival Server mit "/etc/init.d/festival start" starten.
Wenn alles funktioniert hat kann man mit "netstat -anp" sehen, dass der Server auf Port 1314 hört:

tcp        0      0 123.123.123.123:1314        0.0.0.0:*               LISTEN     29714/festival

/etc/asterisk/festival.conf

;
; Festival Configuration
;
[general]
;
; Host which runs the festival server (default : localhost);
;
host=localhost
;
; Port on host where the festival server runs (default : 1314)
;
port=1314
;
; Use cache (yes, no - defaults to no)
;
usecache=yes
;
; If usecache=yes, a directory to store waveform cache files.
; The cache is never cleared (yet), so you must take care of cleaning it
; yourself (just delete any or all files from the cache).
; THIS DIRECTORY *MUST* EXIST and must be writable from the asterisk process.
; Defaults to /tmp/
;
cachedir=/var/lib/asterisk/festivalcache/
;
; Festival command to send to the server.
; Defaults to: (tts_textasterisk "%s" 'file)(quit)

; %s is replaced by the desired text to say. The command MUST end with a
; (quit) directive, or the cache handling mechanism will hang. Do not
; forget the
at the end.
;
festivalcommand=(tts_textasterisk "%s" 'file)(quit)

;
;

/etc/extensions.conf (relevanter Teil, Beispiel)

exten = 12345,1,Answer
exten = 12345,2,wait(2)
exten = 12345,3,Festival('Hello World')
exten = 12345,4,Hangup

Wenn Euch diese Seite weitergeholfen hat, dann verlinkt sie bitte. Ihr habt ein Problem? Fragen, Anregungen und Kritik bitte an feedback@lilalinux.net
Ihr könnt mich auch per ICQ erreichen: 1028730, sowie mit Jabber/GoogleTalk/XMPP: lilalinux@jabber.net-lab.net