FreeTTS Client/Server Demo |
This demo provides an example of how to run a FreeTTS synthesizer as a server on the network: a simple client sends the server some text, and the the server streams back audio. Note that since we use a very simple socket-based protocol for the server, the client can be written in any language (i.e., the client does not have to be written in the JavaTM programming language).
People have used this demo as the basis for generating speech output on a wireless PDA.
To build this demo, merely type the following in a shell from any directory in the FreeTTS hierarchy:
ant -find demo.xml
Doing so will create
bin/Server.jar
and
bin/Client.jar
under the top level directory.
You can run both using java -jar
(see "Running" below).
We've also provided a simple C client,
client.c
, which you can compile using the
following command:
gcc -Wall -lxnet -o cclient client.c
To use this demo, you need to run two things: the Server and the Client.
To run the Server, on the machine you want to run the server, type the following from a command window at the top level FreeTTS directory:
java -jar bin/Server.jar
This runs the TTS Server at port 5555. To change the port,
modify the port
system property:
java -Dport=5555 -jar bin/Server.jar
The Server will start and will configure itself to support requests for both 8kHz and 16kHz voices. You should see the following output:
Waiting on ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=5555]
To specify the 8kHz and 16kHz voices, you need to set the
voice8kName
and voice16kName
system
properties (default values shown):
java -Dvoice8kName=kevin -Dvoice16kName=kevin16 -jar bin/Server.jar
java -Dvoice16kName=mbrola_us1 -Dmbrola.base=/usr/local/mbrola -jar bin/Server.jar
(*)
(*) The MBROLA voices are 16kHz voices. You must setup and install MBROLA before using MBROLA voices.
To see how quickly the server handles TTS request, you can
set the metrics
system property to
true
. This will cause the "time to first byte
sent" to client to be printed out for each TTS request:
java -Dmetrics=true -jar bin/Server.jar
To run the client, you need to tell it where the Server is
running by setting the server
,
port
, sampleRate
and
metrics
properties (default values shown):
java -Dserver=localhost -Dport=5555
-DsampleRate=16000 -Dmetrics=false -jar bin/Client.jar
To run the C client, you can run it with the following optional arguments:
cclient [server [port [sample_rate [show_metrics]]]]
where:
server: the host name of speech server port: port where the speech server is listening sample_rate: 8000 or 16000 show_metrics: 0 or 1
After running either of the clients, the following prompt should appear:
Receiving : 32886 samples Say :
and you should hear a voice saying "type in what you want me to say." At this point, you should hear what you type in (and press Enter).
See the license terms
and acknowledgments.
Copyright 2001,2003 Sun Microsystems, Inc. All Rights
Reserved. Use is subject to license terms.