| 1 |
diff -u -r festival-1.4.3/lib/tts.scm festival-1.4.3-asterisk/lib/tts.scm |
| 2 |
--- festival-1.4.3/lib/tts.scm 2003-01-09 07:39:22.000000000 -0800 |
| 3 |
+++ festival-1.4.3-asterisk/lib/tts.scm 2003-08-14 12:07:00.000000000 -0700 |
| 4 |
@@ -234,6 +234,17 @@ |
| 5 |
(utt.synth |
| 6 |
(eval (list 'Utterance 'Text string)))))) |
| 7 |
|
| 8 |
+;; begin tts_textasterisk |
| 9 |
+(define (tts_textasterisk string mode) |
| 10 |
+ "(tts_textasterisk STRING MODE) |
| 11 |
+Apply tts to STRING. This function is specifically designed for |
| 12 |
+use in server mode so a single function call may synthesize the string. |
| 13 |
+This function name may be added to the server safe functions." |
| 14 |
+ (utt.send.wave.asterisk |
| 15 |
+ (utt.synth |
| 16 |
+ (eval (list 'Utterance 'Text string))))) |
| 17 |
+;; end tts_textasterisk |
| 18 |
+ |
| 19 |
(define (tts_return_to_client) |
| 20 |
"(tts_return_to_client) |
| 21 |
This function is called by clients who wish to return waveforms of |
| 22 |
diff -u -r festival-1.4.3/src/arch/festival/wave.cc festival-1.4.3-asterisk/src/arch/festival/wave.cc |
| 23 |
--- festival-1.4.3/src/arch/festival/wave.cc 2003-01-13 11:09:55.000000000 -0800 |
| 24 |
+++ festival-1.4.3-asterisk/src/arch/festival/wave.cc 2003-08-14 12:10:53.000000000 -0700 |
| 25 |
@@ -381,6 +381,7 @@ |
| 26 |
type = "nist"; |
| 27 |
else |
| 28 |
type = get_c_string(ltype); |
| 29 |
+ |
| 30 |
w->save(tmpfile,type); |
| 31 |
#ifdef WIN32 |
| 32 |
send(ft_server_socket,"WV\n",3,0); |
| 33 |
@@ -393,6 +394,44 @@ |
| 34 |
return utt; |
| 35 |
} |
| 36 |
|
| 37 |
+// begin utt_send_wave_asterisk() |
| 38 |
+static LISP utt_send_wave_asterisk(LISP utt) |
| 39 |
+{ |
| 40 |
+ // Send the waveform to a client (must be acting as server) |
| 41 |
+ EST_Utterance *u = utterance(utt); |
| 42 |
+ EST_Wave *w; |
| 43 |
+ EST_String tmpfile = make_tmp_filename(); |
| 44 |
+ LISP ltype; |
| 45 |
+ EST_String type; |
| 46 |
+ |
| 47 |
+ w = get_utt_wave(u); |
| 48 |
+ if (ft_server_socket == -1) |
| 49 |
+ { |
| 50 |
+ cerr << "utt_send_wave_client: not in server mode" << endl; |
| 51 |
+ festival_error(); |
| 52 |
+ } |
| 53 |
+ |
| 54 |
+ ltype = ft_get_param("Wavefiletype"); |
| 55 |
+ if (ltype == NIL) |
| 56 |
+ type = "nist"; |
| 57 |
+ else |
| 58 |
+ type = get_c_string(ltype); |
| 59 |
+ w->resample(8000); |
| 60 |
+ w->rescale(5); |
| 61 |
+ |
| 62 |
+ w->save(tmpfile,type); |
| 63 |
+#ifdef WIN32 |
| 64 |
+ send(ft_server_socket,"WV\n",3,0); |
| 65 |
+#else |
| 66 |
+ write(ft_server_socket,"WV\n",3); |
| 67 |
+#endif |
| 68 |
+ socket_send_file(ft_server_socket,tmpfile); |
| 69 |
+ unlink(tmpfile); |
| 70 |
+ |
| 71 |
+ return utt; |
| 72 |
+} |
| 73 |
+// end utt_send_wave_asterisk() |
| 74 |
+ |
| 75 |
static LISP send_sexpr_to_client(LISP l) |
| 76 |
{ |
| 77 |
EST_String tmpfile = make_tmp_filename(); |
| 78 |
@@ -465,6 +504,15 @@ |
| 79 |
"(utt.send.wave.client UTT)\n\ |
| 80 |
Sends wave in UTT to client. If not in server mode gives an error\n\ |
| 81 |
Note the client must be expecting to receive the waveform."); |
| 82 |
+ |
| 83 |
+// begin asterisk mod |
| 84 |
+ init_subr_1("utt.send.wave.asterisk",utt_send_wave_asterisk, |
| 85 |
+ "(utt.send.wave.asterisk UTT)\n\ |
| 86 |
+ Sends wave in UTT to client. If not in server mode gives an error\n\ |
| 87 |
+ Note the client must be expecting to receive the waveform. The waveform\n\ |
| 88 |
+ is rescaled and resampled according to what asterisk needs"); |
| 89 |
+// end asterisk mod |
| 90 |
+ |
| 91 |
init_subr_1("send_sexpr_to_client", send_sexpr_to_client, |
| 92 |
"(send_sexpr_to_client SEXPR)\n\ |
| 93 |
Sends given sexpression to currently connected client."); |