public class MaryHttpServer extends Thread
MaryProperties.socketPort()
.
There are two types of clients that can be handled:
(1) Non-web browser clients (2) Web browser clients
Note that non-web browser clients can mimic web browser clients by setting WEB_BROWSER_CLIENT parameter to "true" in the Http request string
Clients can request the following (See below for more details):
(1) A file such as Mary icon or an audio file (2) Information like available voices, example texts, available audio formats, etc (3) Synthesis of an appropriate input with appropriate additional parameters
For all clients, the responses are always sent in an HttpResponse. The entity in the response body can represent:
(1) An html page (applies only to web browser clients) (2) Some binary data (such as bytes of Mary icon for file requests, or bytes of audio data for synthesis requests) (3) Some piece of text
A valid Mary Http request string is a collection of individual key-value pairs combined in Http request style:
address?pair1&pair2&pair3...
etc.
The address
identifies the kind of thing that the client is asking for:
version
requests the version of the MARY server;datatypes
requests the list of available data types;locales
requests the list of available locales / language components;voices
requests the list of available voices;audioformats
requests the list of supported audio file format types;exampletext?voice=hmm-slt
requests the example text for the given voice;exampletext?datatype=RAWMARYXML&locale=de
requests an example text for data of the given type and locale;audioeffects
requests the list of default audio effects;audioeffect-default-param?effect=Robot
requests the default parameters of the given audio effect;audioeffect-full?effect=Robot¶ms=amount:100.0
requests a full description of the given audio effect,
including effect name, parameters and help text;audioeffect-help?effect=Robot
requests a help text describing the given audio effect;audioeffect-is-hmm-effect?effect=Robot
requests a boolean value (plain text "yes" or "no") indicating whether
or not the given effect is an effect that operates on HMM-based voices only;features?locale=de
requests the list of available features that can be computed for the given locale;features?voice=hmm-slt
requests the list of available features that can be computed for the given voice;vocalizations?voice=dfki-poppy
requests the list of vocalization names that are available with the given
voice;
styles?voice=dfki-pavoque-styles
requests the list of style names that are available with the given voice;
process
requests the synthesis of some text (see below).In Each pair has the following structure:
KEY=VALUE
where the following keys are used for passing additional information from server to client and/or vice versa:
INPUT_TYPE (input data type)
OUTPUT_TYPE (output data type)
AUDIO (audio format. It may include streaming/non-streaming information as well. Example values for non-streaming formats: AU_FILE, MP3_FILE, WAVE_FILE Example values for streaming formats: AU_STREAM, MP3_STREAM)
STYLE (Style descriptor)
INPUT_TEXT (Input text to be synthesised)
OUTPUT_TEXT (Output text - if the output type is not audio)
SYNTHESIS_OUTPUT (A key to ask for synthesis, or to represent synthesis result. Example values: SYNTHESIS_OUTPUT=? instantiates a synthesis request In response, the server can set SYNTHESIS_OUTPUT to DONE, PENDING, or FAILED depending on the validity and type of te request PENDING is a special case used for handling double requests due to EMBED or OBJECT tags in web browser client html pages
Additionally, web browser clients should use the following key-value pair to tell the server about their type:
WEB_BROWSER_CLIENT=true (All other values will be interpreted as non-web browser client)
An easy way to test the http server is as follows:
(1) Run mary server in "http" mode by setting server=http in marybase.config
(2) Copy and paste the following to a web browser´s address bar:
Provided that the server runs at localhost:59125 (or change "http://localhost:59125/" part as required), the web browser supports AUDIO type (if not try other formats such as WAVE, MP3, OGG or install a plug-in to play the target format), and the VOICE is installed (hmm-slt), the synthesis result should be sent to the web browser for playback or saving (depending on web browser settings).
check InfoRequestHandler
, FileRequestHandler
, SynthesisRequestHandler
.
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
MaryHttpServer() |
Modifier and Type | Method and Description |
---|---|
boolean |
isReady() |
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
Copyright © 2000–2016 DFKI GmbH. All rights reserved.