mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
Version 0.2.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
22
contrib/README.festival
Executable file
22
contrib/README.festival
Executable file
@@ -0,0 +1,22 @@
|
||||
|
||||
app_festival is an application that allows one to send text-to-speech commands
|
||||
to a background festival server, and to obtain the resulting waveform which
|
||||
gets sent down to the respective channel. app_festival also employs a waveform
|
||||
cache, so invariant text-to-speech strings ("Please press 1 for instructions")
|
||||
do not need to be dynamically generated all the time.
|
||||
|
||||
You need :
|
||||
|
||||
1) festival, patched to produce 8khz waveforms on output. Patch for Festival
|
||||
1.4.1 RELEASE are included. The patch adds a new command to festival
|
||||
(asterisk_tts).
|
||||
|
||||
2) My patches to asterisk that provide variable substitution and quoting to
|
||||
the Asterisk Extension Logic. This is not really a requirement, but without
|
||||
this, app_festival is mostly useless (you could very well use prerecorded
|
||||
voices for static information).
|
||||
|
||||
3) Before running asterisk, you have to run festival-server with a command
|
||||
like :
|
||||
|
||||
/usr/local/festival/bin/festival --server > /dev/null 2>&1 &
|
||||
76
contrib/festival-1.4.1-diff
Executable file
76
contrib/festival-1.4.1-diff
Executable file
@@ -0,0 +1,76 @@
|
||||
diff -ruN festival/lib/tts.scm myfestival/lib/tts.scm
|
||||
--- festival/lib/tts.scm Sun May 30 16:40:00 1999
|
||||
+++ myfestival/lib/tts.scm Wed Apr 17 22:29:34 2002
|
||||
@@ -200,6 +200,15 @@
|
||||
(utt.synth
|
||||
(eval (list 'Utterance 'Text string)))))
|
||||
|
||||
+(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 maybe added to the server safe functions."
|
||||
+ (utt.send.wave.asterisk
|
||||
+ (utt.synth
|
||||
+ (eval (list 'Utterance 'Text string)))))
|
||||
+
|
||||
(define (tts_return_to_client)
|
||||
"(tts_return_to_client)
|
||||
This function is called by clients who wish to return waveforms of
|
||||
diff -ruN festival/src/arch/festival/wave.cc myfestival/src/arch/festival/wave.cc
|
||||
--- festival/src/arch/festival/wave.cc Sat Jun 12 10:30:30 1999
|
||||
+++ myfestival/src/arch/festival/wave.cc Thu Apr 18 10:55:32 2002
|
||||
@@ -375,6 +375,38 @@
|
||||
type = "nist";
|
||||
else
|
||||
type = get_c_string(ltype);
|
||||
+
|
||||
+ w->save(tmpfile,type);
|
||||
+ write(ft_server_socket,"WV\n",3);
|
||||
+ socket_send_file(ft_server_socket,tmpfile);
|
||||
+ unlink(tmpfile);
|
||||
+
|
||||
+ return utt;
|
||||
+}
|
||||
+
|
||||
+static LISP utt_send_wave_asterisk(LISP utt)
|
||||
+{
|
||||
+ // Send the waveform to a client (must be acting as server)
|
||||
+ EST_Utterance *u = utterance(utt);
|
||||
+ EST_Wave *w;
|
||||
+ EST_String tmpfile = make_tmp_filename();
|
||||
+ LISP ltype;
|
||||
+ EST_String type;
|
||||
+
|
||||
+ w = get_utt_wave(u);
|
||||
+ if (ft_server_socket == -1)
|
||||
+ {
|
||||
+ cerr << "utt_send_wave_client: not in server mode" << endl;
|
||||
+ festival_error();
|
||||
+ }
|
||||
+
|
||||
+ ltype = ft_get_param("Wavefiletype");
|
||||
+ if (ltype == NIL)
|
||||
+ type = "nist";
|
||||
+ else
|
||||
+ type = get_c_string(ltype);
|
||||
+ w->resample(8000);
|
||||
+ w->rescale(5);
|
||||
w->save(tmpfile,type);
|
||||
write(ft_server_socket,"WV\n",3);
|
||||
socket_send_file(ft_server_socket,tmpfile);
|
||||
@@ -434,6 +466,13 @@
|
||||
"(utt.send.wave.client UTT)\n\
|
||||
Sends wave in UTT to client. If not in server mode gives an error\n\
|
||||
Note the client must be expecting to receive the waveform.");
|
||||
+
|
||||
+ init_subr_1("utt.send.wave.asterisk",utt_send_wave_asterisk,
|
||||
+ "(utt.send.wave.asterisk UTT)\n\
|
||||
+ Sends wave in UTT to client. If not in server mode gives an error\n\
|
||||
+ Note the client must be expecting to receive the waveform. The waveform
|
||||
+ is rescaled and resampled according to what asterisk needs");
|
||||
+
|
||||
init_subr_2("utt.save.f0",utt_save_f0,
|
||||
"(utt.save.f0 UTT FILENAME)\n\
|
||||
Save F0 of UTT as esps track file in FILENAME.");
|
||||
|
||||
Reference in New Issue
Block a user