marytts.server
Class MaryServer
java.lang.Object
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.
- 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:
- TEXT_EN plain ASCII text, English (input only)
- SABLE text annotated with SABLE markup (input only)
- SSML text annotated with SSML markup (input only)
- APML text annotated with APML markup (input only)
- RAWMARYXML untokenised MaryXML
- TOKENS_EN tokenized text
- WORDS_EN numbers and abbreviations expanded
- POS_EN parts of speech tags added
- SEGMENTS_EN phone symbols
- INTONATION_EN ToBI intonation symbols
- POSTPROCESSED_EN post-lexical phonological rules
- ACOUSTPARAMS acoustic parameters in MaryXML structure
- MBROLA phone symbols, duration and frequency values
- AUDIO audio data (output only)
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:
- WAVE
- AU
- SND
- AIFF
- AIFC
- MP3
- Vorbis
- STREAMING_AU
- STREAMING_MP3
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".
- 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.
- 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.
- The server groups dataSocket and infoSocket together based on this
identification number, and starts reading data of the requested input
type from
dataSocket.
- If any errors or warning messages are issued during input parsing or
consecutive processing, these are printed to
infoSocket.
- The processing result is output to
dataSocket.
- Author:
- Marc Schröder
- See Also:
RequestHandler
|
Method Summary |
void |
run()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MaryServer
public MaryServer()
run
public void run()
throws java.io.IOException,
NoSuchPropertyException
- Throws:
java.io.IOException
NoSuchPropertyException