aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/festival-1.4.2.diff
blob: d5d1e5d54c43bed6b409eb68d278edb8b97d020b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
diff -u -r festival-1.4.2/lib/tts.scm festival-1.4.2-asterisk/lib/tts.scm
--- festival-1.4.2/lib/tts.scm	Wed Jan  8 09:54:14 2003
+++ festival-1.4.2-asterisk/lib/tts.scm	Tue Jan  7 08:51:44 2003
@@ -236,6 +236,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 may be 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 -u -r festival-1.4.2/src/arch/festival/wave.cc festival-1.4.2-asterisk/src/arch/festival/wave.cc
--- festival-1.4.2/src/arch/festival/wave.cc	Mon Jun  4 07:40:10 2001
+++ festival-1.4.2-asterisk/src/arch/festival/wave.cc	Tue Jan  7 08:53:09 2003
@@ -377,6 +377,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);
@@ -454,6 +486,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\n\
+  is rescaled and resampled according to what asterisk needs");
+
     init_subr_1("send_sexpr_to_client", send_sexpr_to_client,
  "(send_sexpr_to_client SEXPR)\n\
 Sends given sexpression to currently connected client.");