marytts.server
Class MaryServer

java.lang.Object
  extended by marytts.server.MaryServer

public class MaryServer
extends java.lang.Object

Listen for clients on socket port MaryProperties.socketPort(). For each new client, create a new RequestHandler thread.

Clients are expected to follow the following protocol:

A client opens two socket connections to the server. The first, infoSocket, serves for passing meta-information, such as the requested input and output types or warnings. The second, dataSocket, serves for passing the actual input and output data. The server expects the communication as follows.

  1. The client opens an infoSocket, optionally sends one line "MARY VERSION" to obtain three lines of version information, and then sends one line "MARY IN=INPUTTYPE OUT=OUTPUTTYPE [AUDIO=AUDIOTYPE]", where INPUTTYPE and OUTPUTTYPE can have a number of different values, depending on the configuration with which the server was started. For an English system, these values include: INPUTTYPE must be earlier in this list than OUTPUTTYPE. The list of input and output data types can be requested from the server by sending it a line "MARY LIST DATATYPES". The server will reply with a list of lines where each line represents one data type, e.g. "RAWMARYXML INPUT OUTPUT", "TEXT INPUT" or "AUDIO OUTPUT". See the code in MaryClient.fillDataTypes().

    The optional AUDIO=AUDIOTYPE specifies the type of audio file to be sent for audio output. Possible values are:

    The optional VOICE=VOICENAME specifies the default voice with which the text is to be spoken. As for the data types, possible values depend on the configuration of the server. The list can be retrieved by sending the server a line "MARY LIST VOICES", which will reply with lines such as "de7 de female", "kevin16 en male" or "us2 en male".

    The optional EFFECTS=EFFECTSWITHPARAMETERS specifies the audio effects to be applied as a post-processing step along with their parameters. EFFECTSWITHPARAMETERS is a String of the form "Effect1Name(Effect1Parameter1=Effect1Value1; Effect1Parameter2=Effect1Value2), Effect2Name(Effect2Parameter1=Effect2Value1)" For example, "Robot(amount=100),Whisper(amount=50)" will convert the output into a whispered robotic voice with the specified amounts.

    Example: The line

       MARY IN=TEXT_EN OUT=AUDIO AUDIO=WAVE VOICE=kevin16 EFFECTS
     
    will process normal ASCII text, and send back a WAV audio file synthesised with the voice "kevin16".
  2. The server reads and parses this input line. If its format is correct, a line containing a single integer is sent back to the client on infoSocket. This integer is a unique identification number for this request.
  3. The client opens a second socket connection to the server, on the same port, the dataSocket. As a first line on this dataSocket, it sends the single integer it had just received via the infoSocket.
  4. The server groups dataSocket and infoSocket together based on this identification number, and starts reading data of the requested input type from dataSocket.
  5. If any errors or warning messages are issued during input parsing or consecutive processing, these are printed to infoSocket.
  6. The processing result is output to dataSocket.

Author:
Marc Schröder
See Also:
RequestHandler

Nested Class Summary
 class MaryServer.ClientHandler
           
 
Constructor Summary
MaryServer()
           
 
Method Summary
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaryServer

public MaryServer()
Method Detail

run

public void run()
         throws java.io.IOException,
                NoSuchPropertyException
Throws:
java.io.IOException
NoSuchPropertyException