| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Speechd; |
|
2
|
1
|
|
|
1
|
|
46799
|
use 5.006; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
46
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
38
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
91
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
83
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.50'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1696
|
use IO::Socket::INET; |
|
|
1
|
|
|
|
|
64162
|
|
|
|
1
|
|
|
|
|
71
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=pod |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Speechd - Perl Module wrapper for speech-dispatcher. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Speechd is a Perl module to make it easy to use speech-dispatcher |
|
20
|
|
|
|
|
|
|
for text to speech functions. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $sd = Speachd->new([property => value, property => value, ...]); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 PROPERTIES |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=over 4 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item port : Port number. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Default is 6560 |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item ip : IP address. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Default is 127.0.0.1 |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item voice : Voice name. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Default is MALE1. |
|
41
|
|
|
|
|
|
|
Possible voice names are: |
|
42
|
|
|
|
|
|
|
MALE1 MALE2 MALE3 FEMALE1 FEMALE2 FEMALE3 CHILD_MALE CHILD_FEMALE |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item rate : Speaking rate. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Default is 0. |
|
47
|
|
|
|
|
|
|
Possible values are from -100 to 100. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item volume : Speaking volume. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Default is 0. |
|
52
|
|
|
|
|
|
|
Possible values are from -100 to 100. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item pitch : Speaking pitch. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Default is 0. |
|
57
|
|
|
|
|
|
|
Possible values are from -100 to 100. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item lang : Speaking lanuage. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Default value is en (english). |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 METHODS |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item new |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $sd = Speachd->new([property => value, property => value, ...]); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Creates a new instance of the Speachd object. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub new { |
|
78
|
0
|
|
|
0
|
1
|
|
my $pkg = shift; |
|
79
|
0
|
|
|
|
|
|
my $self = { |
|
80
|
|
|
|
|
|
|
"port" => 6560, |
|
81
|
|
|
|
|
|
|
"ip" => "127.0.0.1", |
|
82
|
|
|
|
|
|
|
"voice" => "MALE1", |
|
83
|
|
|
|
|
|
|
"rate" => 0, |
|
84
|
|
|
|
|
|
|
"volume" => 0, |
|
85
|
|
|
|
|
|
|
"pitch" => 0, |
|
86
|
|
|
|
|
|
|
"lang" => "en", |
|
87
|
|
|
|
|
|
|
@_}; |
|
88
|
0
|
|
|
|
|
|
return bless $self, $pkg; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=pod |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item connect |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$sd->connect(); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Connect a socket to speech-dispatcher. |
|
98
|
|
|
|
|
|
|
This must be called before methods say, cancel, voice, |
|
99
|
|
|
|
|
|
|
volume, pitch, lang, and config_voice can be used. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
|
102
|
|
|
|
|
|
|
sub connect { |
|
103
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
104
|
0
|
0
|
|
|
|
|
$self->{socket} = IO::Socket::INET->new( |
|
105
|
|
|
|
|
|
|
PeerAddr => $self->{ip}, |
|
106
|
|
|
|
|
|
|
PeerPort => $self->{port}, |
|
107
|
|
|
|
|
|
|
Proto => "tcp", |
|
108
|
|
|
|
|
|
|
Type => SOCK_STREAM, |
|
109
|
|
|
|
|
|
|
Blocking => 0, |
|
110
|
|
|
|
|
|
|
) or die " |
|
111
|
|
|
|
|
|
|
Couldn't connect to speechd on port $self->{'port'} and IP $self->{'ip'}: |
|
112
|
|
|
|
|
|
|
$@\n |
|
113
|
|
|
|
|
|
|
Perhaps speech-dispatcher is not running."; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
=pod |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item disconnect |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$sd->disconnect(); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Disconnect socket from speech-dispatcher. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
|
124
|
|
|
|
|
|
|
sub disconnect { |
|
125
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
126
|
0
|
|
|
|
|
|
$self->sendraw("quit\r\n"); |
|
127
|
0
|
|
|
|
|
|
$self->{socket}->close(); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=pod |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item port |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$sd->port([$port_number]); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
If port number is given; sets port number and returns previos value. |
|
137
|
|
|
|
|
|
|
If no port number is given; returns value. |
|
138
|
|
|
|
|
|
|
Default value is 6560 |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
|
141
|
|
|
|
|
|
|
sub port { |
|
142
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
143
|
0
|
|
|
|
|
|
my $port = shift; |
|
144
|
0
|
|
|
|
|
|
my $ret = $self->{'port'}; |
|
145
|
0
|
0
|
|
|
|
|
if ($port) { |
|
146
|
0
|
|
|
|
|
|
$self->{'port'} = $port; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
0
|
|
|
|
|
|
return $ret; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=pod |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item ip |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$sd->ip([$ip_address]); |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
If ip address is given; sets ip address and returns previos value. |
|
158
|
|
|
|
|
|
|
If no ip address is given; returns value. |
|
159
|
|
|
|
|
|
|
Default value is 127.0.0.1 |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
|
162
|
|
|
|
|
|
|
sub ip { |
|
163
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
164
|
0
|
|
|
|
|
|
my $ip = shift; |
|
165
|
0
|
|
|
|
|
|
my $ret = $self->{ip}; |
|
166
|
0
|
0
|
|
|
|
|
if ($ip) { |
|
167
|
0
|
|
|
|
|
|
$self->{ip} = $ip; |
|
168
|
|
|
|
|
|
|
} |
|
169
|
0
|
|
|
|
|
|
return $ret; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=pod |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item voice |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
$sd->voice([$voice]); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
If voice is given; sets voice and returns previos value. |
|
179
|
|
|
|
|
|
|
If no voice is given; returns value. |
|
180
|
|
|
|
|
|
|
Default value is MALE1. Possible values are: |
|
181
|
|
|
|
|
|
|
MALE1 MALE2 MALE3 FEMALE1 FEMALE2 FEMALE3 CHILD_MALE CHILD_FEMALE |
|
182
|
|
|
|
|
|
|
If not connected, method msg will return error. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |
|
185
|
|
|
|
|
|
|
sub voice { |
|
186
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
187
|
0
|
|
|
|
|
|
my $voice = shift; |
|
188
|
0
|
|
|
|
|
|
my $ret = $self->{voice}; |
|
189
|
0
|
0
|
|
|
|
|
if ($voice) { |
|
190
|
0
|
|
|
|
|
|
$self->{voice} = $voice; |
|
191
|
0
|
|
|
|
|
|
$self->sendraw("set self voice $voice\r\n"); |
|
192
|
|
|
|
|
|
|
} |
|
193
|
0
|
|
|
|
|
|
return $ret; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=pod |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item rate |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
$sd->rate([$rate]); |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
If rate is given; sets rate and returns previos value. |
|
203
|
|
|
|
|
|
|
If no rate is given; returns value. |
|
204
|
|
|
|
|
|
|
Default value is 0. Possible values are from -100 to 100. |
|
205
|
|
|
|
|
|
|
If not connected, method msg will return error. |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
|
208
|
|
|
|
|
|
|
sub rate { |
|
209
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
210
|
0
|
|
|
|
|
|
my $rate = shift; |
|
211
|
0
|
|
|
|
|
|
my $ret = $self->{rate}; |
|
212
|
0
|
0
|
|
|
|
|
if ($rate) { |
|
213
|
0
|
|
|
|
|
|
$self->{rate} = $rate; |
|
214
|
0
|
|
|
|
|
|
$self->sendraw("set self rate $rate\r\n"); |
|
215
|
|
|
|
|
|
|
} |
|
216
|
0
|
|
|
|
|
|
return $ret; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=pod |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item volume |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
$sd->volume([$volume]); |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
If volume is given; sets volume and returns previos value. |
|
226
|
|
|
|
|
|
|
If no volume is given; returns value. |
|
227
|
|
|
|
|
|
|
Default value is 0. Possible values are from -100 to 100. |
|
228
|
|
|
|
|
|
|
If not connected, method msg will return error. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |
|
231
|
|
|
|
|
|
|
sub volume { |
|
232
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
233
|
0
|
|
|
|
|
|
my $volume = shift; |
|
234
|
0
|
|
|
|
|
|
my $ret = $self->{volume}; |
|
235
|
0
|
0
|
|
|
|
|
if ($volume) { |
|
236
|
0
|
|
|
|
|
|
$self->{volume} = $volume; |
|
237
|
0
|
|
|
|
|
|
$self->sendraw("set self volume $volume\r\n"); |
|
238
|
|
|
|
|
|
|
} |
|
239
|
0
|
|
|
|
|
|
return $ret; |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=pod |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item pitch |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
$sd->pitch([$pitch]); |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
If volume is given; sets volume and returns previos value. |
|
249
|
|
|
|
|
|
|
If no volume is given; returns value. |
|
250
|
|
|
|
|
|
|
Default value is 0. Possible values are from -100 to 100. |
|
251
|
|
|
|
|
|
|
If not connected, method msg will return error. |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=cut |
|
254
|
|
|
|
|
|
|
sub pitch { |
|
255
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
256
|
0
|
|
|
|
|
|
my $pitch = shift; |
|
257
|
0
|
|
|
|
|
|
my $ret = $self->{pitch}; |
|
258
|
0
|
0
|
|
|
|
|
if ($pitch) { |
|
259
|
0
|
|
|
|
|
|
$self->{pitch} = $pitch; |
|
260
|
0
|
|
|
|
|
|
$self->sendraw("set self pitch $pitch\r\n"); |
|
261
|
|
|
|
|
|
|
} |
|
262
|
0
|
|
|
|
|
|
return $ret; |
|
263
|
|
|
|
|
|
|
} |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=pod |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item lang |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
$sd->lang([$lang]); |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
If lang is given; sets language and returns previos value. |
|
272
|
|
|
|
|
|
|
If no lang is given; returns value. |
|
273
|
|
|
|
|
|
|
Default value is en. |
|
274
|
|
|
|
|
|
|
If not connected, method msg will return error. |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=cut |
|
277
|
|
|
|
|
|
|
sub lang { |
|
278
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
279
|
0
|
|
|
|
|
|
my $lang = shift; |
|
280
|
0
|
|
|
|
|
|
my $ret = $self->{lang}; |
|
281
|
0
|
0
|
|
|
|
|
if ($lang) { |
|
282
|
0
|
|
|
|
|
|
$self->{lang} = $lang; |
|
283
|
0
|
|
|
|
|
|
$self->sendraw("set self language $lang\r\n"); |
|
284
|
|
|
|
|
|
|
} |
|
285
|
0
|
|
|
|
|
|
return $ret; |
|
286
|
|
|
|
|
|
|
} |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=pod |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item config_voice |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
$sd->config_voice($voice, $lang, [$rate, $volume, $pitch]); |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Sets parameters for speech-dispatcher. |
|
295
|
|
|
|
|
|
|
See individual methods for possible values. |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=cut |
|
298
|
|
|
|
|
|
|
sub config_voice { # voice, lang, rate, volume, pitch |
|
299
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
300
|
0
|
|
|
|
|
|
my $voice = shift; |
|
301
|
0
|
|
|
|
|
|
my $lang = shift; |
|
302
|
0
|
|
|
|
|
|
my $rate = shift; |
|
303
|
0
|
|
|
|
|
|
my $vol = shift; |
|
304
|
0
|
|
|
|
|
|
my $pitch = shift; |
|
305
|
0
|
|
|
|
|
|
$self->voice($voice); |
|
306
|
0
|
|
|
|
|
|
$self->rate($rate); |
|
307
|
0
|
|
|
|
|
|
$self->volume($vol); |
|
308
|
0
|
|
|
|
|
|
$self->pitch($pitch); |
|
309
|
0
|
|
|
|
|
|
$self->lang($lang); |
|
310
|
|
|
|
|
|
|
} |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=pod |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=item msg |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
my $message = $sd->msg(); |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Returns and clears messages from previous command sent to speechd. |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=cut |
|
321
|
|
|
|
|
|
|
sub msg { |
|
322
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
323
|
0
|
|
|
|
|
|
my $msg = $self->{msg}; |
|
324
|
0
|
|
|
|
|
|
$self->{msg} = ""; |
|
325
|
0
|
|
|
|
|
|
return $msg; |
|
326
|
|
|
|
|
|
|
} |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=pod |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=item say |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
$sd->say($text_to_speak); |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Sends text to speech-dispatcher to be spoken. |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=cut |
|
338
|
|
|
|
|
|
|
sub say { |
|
339
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
340
|
0
|
|
|
|
|
|
my $text = shift; |
|
341
|
0
|
|
|
|
|
|
$self->sendraw("speak\r\n$text\r\n.\r\n"); |
|
342
|
|
|
|
|
|
|
} |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=pod |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=item cancel |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
$sd->cancel(); |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
Kills speech. |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=cut |
|
353
|
|
|
|
|
|
|
sub cancel { |
|
354
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
355
|
0
|
|
|
|
|
|
$self->sendraw("cancel self\r\n"); |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=pod |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=item get_voices |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
my $voices = $sd->get_voices(); |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
Returns a reference to an array holding all possible voice names. |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=cut |
|
367
|
|
|
|
|
|
|
sub get_voices { |
|
368
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
369
|
0
|
|
|
|
|
|
my @voice_lst = qw(MALE1 MALE2 MALE3 FEMALE1 FEMALE2 FEMALE3 CHILD_MALE CHILD_FEMALE); |
|
370
|
0
|
|
|
|
|
|
return \@voice_lst; |
|
371
|
|
|
|
|
|
|
} |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=pod |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=item sendraw |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
$sd->sendraw($command_to_send_to_speech-dispatcher); |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
Available to send commands directly to speech-dispatcher. |
|
380
|
|
|
|
|
|
|
Puts return messages into msg. |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=back |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=cut |
|
385
|
|
|
|
|
|
|
sub sendraw { |
|
386
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
387
|
0
|
|
|
|
|
|
my $raw = shift; |
|
388
|
0
|
0
|
|
|
|
|
if ($self->{socket}->connected()) { |
|
389
|
0
|
|
|
|
|
|
$self->msg(); |
|
390
|
0
|
|
|
|
|
|
$self->{socket}->print($raw); |
|
391
|
0
|
|
|
|
|
|
while (my $ln = $self->{socket}->getline()) { |
|
392
|
0
|
|
|
|
|
|
$self->{msg} .= $ln; |
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
} else { |
|
395
|
0
|
|
|
|
|
|
$self->{msg} = "Error no socket connection.\n"; |
|
396
|
0
|
|
|
|
|
|
print $self->{msg}; |
|
397
|
|
|
|
|
|
|
} |
|
398
|
|
|
|
|
|
|
} |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
1; |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
__END__ |