# Emacspeak Demo (non-JSAPI version)

This demo implements a text-to-speech server that can be used with Emacspeak. This is the non-JSAPI version, for the JSAPI version, refer to JSAPI Emacspeak (If this link doesn't work, it may be because you have the stripped down "JSAPI Free" version of FreeTTS. To get the full version, go to http://freetts.sourceforge.net).

### Building

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/FreeTTSEmacspeakServer.jar` under the top level directory. You can run the demo using `java -jar` (see "Running the Server" below). This version is sensitive to the existence and location of the `lib` directory, but allows you to drop new voice jar files into the voice directory and take advantage of them.

If you want a self-contained version (i.e., one that includes all it needs in one file and doesn't depend upon anything else), you can build the self-contained version by typing the following in a shell at the top level directory in the FreeTTS hierarchy:

`ant emacspeak-server`

Doing so will create `emacspeak-server.jar` at the top level. You can run this server as described below by merely substituting `emacspeak-server.jar` for `bin/FreeTTSEmacspeakServer.jar`.

### Running the Server

To run this demo, type the following command from a command window at the top level FreeTTS directory:

`java -jar bin/FreeTTSEmacspeakServer.jar`

This runs the TTS Server at port 2222. To change the port, modify the "port" system property:

`java -Dport=2222 -jar bin/FreeTTSEmacspeakServer.jar`

The following should appear:

`Waiting on ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=2222]`

### Specifying a Voice

By default, this application will use the "kevin16" voice that comes with the lib/cmu_us_kal.jar file. You can, however, specify a voice by passing the name of a voice as the first (and only) parameter on the command line:

`java -jar bin/FreeTTSEmacspeakServer.jar kevin`
`java -jar bin/FreeTTSEmacspeakServer.jar kevin16`
`java -Dmbrola.base=/usr/local/mbrola -jar bin/FreeTTSEmacspeakServer.jar mbrola_us1` (*)

(*) You must setup and install MBROLA before using MBROLA voices.

### Specifying Speaking Rate

By default, this application will use the default speaking rate of a voice. To change the speaking rate, you must specify the voice as the first parameter on the command line (as above) and then specify the speaking rate as the second parameter. The speaking rate is nominally the words per minute:

`java -jar bin/FreeTTSEmacspeakServer.jar kevin16 250`

### Connecting to the Server from Emacspeak

In your emacspeak (i.e., emacs with emacspeak running), type the following command:

`M-x emacspeak-remote-connect-to-server`

When you are prompted with "Remote host:", specify the machine the Emacspeak TTS Server is running. The port is 2222 by default. Emacspeak should connect to the TTS Server.

At this point, you should hear "Connecting to server on host..." at your emacspeak client. You should see the following on the server-side:

    Waiting on ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=2222]
    IN   : tts_set_punctuations all
    SPEAK:
    IN   : tts_capitalize 0
    SPEAK:
    IN   : tts_allcaps_beep 0
    SPEAK:
    IN   : tts_split_caps  1
    SPEAK:
    IN   : tts_set_speech_rate 225
    SPEAK:
    IN   : tts_set_character_scale 1.25
    SPEAK:
    IN   : s
    IN   : q {Connecting to server on host sunlabs.east  port 2222 }
    Connecting to server on host sunlabs.east  port 2222
    SPEAK: "Connecting to server on host sunlabs.east  port 2222"
    IN   : d
    SPEAK:
    IN   : d
    SPEAK:
    IN   : tts_set_punctuations some
    SPEAK:
    IN   : tts_capitalize 0
    SPEAK:
    IN   : tts_allcaps_beep 0
    SPEAK:
    IN   : tts_split_caps  1
    SPEAK:
    IN   : tts_set_speech_rate 225
    SPEAK:
    IN   : tts_set_character_scale 1.25
    SPEAK:
    IN   : d
    SPEAK:

See the license terms and acknowledgments.
Copyright 2001,2003,2005 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.