public abstract class MaryClient extends Object
A GUI interface to this client
,
Description of the MARY protocol
Modifier and Type | Class and Description |
---|---|
static interface |
MaryClient.AudioPlayerListener
A means of letting a caller code know that the audioplayer has finished.
|
static class |
MaryClient.DataType
An abstraction of server info about available data types.
|
static class |
MaryClient.Voice
An abstraction of server info about available voices.
|
static class |
MaryClient.WarningReader |
Modifier and Type | Field and Description |
---|---|
protected boolean |
beQuiet |
protected MaryFormData |
data |
protected boolean |
doProfile |
Modifier | Constructor and Description |
---|---|
protected |
MaryClient()
The simplest way to create a mary client.
|
protected |
MaryClient(Address serverAddress)
The typical way to create a mary client.
|
protected |
MaryClient(Address serverAddress,
boolean profile,
boolean quiet)
An alternative way to create a mary client, which works with applets.
|
protected |
MaryClient(boolean quiet) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
_process(String input,
String inputType,
String outputType,
String locale,
String audioType,
String defaultVoiceName,
String defaultStyle,
String defaultEffects,
Object output,
long timeout,
boolean streamingAudio,
String outputTypeParams,
MaryClient.AudioPlayerListener playerListener) |
protected abstract void |
fillAudioFileFormatAndOutTypes() |
protected abstract void |
fillDataTypes() |
protected abstract void |
fillEffectHelpText(String effectName) |
protected abstract void |
fillLocales() |
protected abstract void |
fillServerExampleText(String dataType,
String locale) |
protected abstract void |
fillServerVersion() |
protected abstract void |
fillVoiceExampleTexts(String voicename) |
protected abstract void |
fillVoices() |
Address |
getAddress() |
Vector<MaryClient.DataType> |
getAllDataTypes()
Obtain a list of all data types known to the server.
|
String |
getAudioEffects() |
static AudioFileFormat.Type |
getAudioFileFormatType(String name)
Return an audio file format type for the given string.
|
Vector<String> |
getAudioFileFormatTypes()
Get the audio file format types known by the server, one per line.
|
Vector<String> |
getAudioOutTypes() |
protected abstract String |
getDefaultAudioEffects()
Request the available audio effects for a voice from the server
|
abstract String |
getFeatures(String locale) |
abstract String |
getFeaturesForVoice(String voice) |
Vector<MaryClient.Voice> |
getGeneralDomainVoices()
Provide a list of general domain voices known to the server.
|
Vector<MaryClient.Voice> |
getGeneralDomainVoices(Locale locale)
Provide a list of general domain voices known to the server.
|
String |
getHost() |
Vector<MaryClient.DataType> |
getInputDataTypes()
Obtain a list of input data types known to the server.
|
Vector<MaryClient.Voice> |
getLimitedDomainVoices()
Provide a list of limited domain voices known to the server.
|
Vector<MaryClient.Voice> |
getLimitedDomainVoices(Locale locale)
Provide a list of limited domain voices known to the server.
|
Set<Locale> |
getLocales() |
static MaryClient |
getMaryClient() |
static MaryClient |
getMaryClient(Address serverAddress)
The typical way to create a mary client.
|
static MaryClient |
getMaryClient(Address serverAddress,
boolean profile,
boolean quiet) |
Vector<MaryClient.DataType> |
getOutputDataTypes()
Obtain a list of output data types known to the server.
|
int |
getPort() |
String |
getServerExampleText(String dataType,
String locale)
Request an example text for a given data type from the server.
|
Vector<String> |
getVoiceExampleTextsLimitedDomain(String voicename)
Request the example texts of a limited domain unit selection voice from the server
|
Vector<MaryClient.Voice> |
getVoices()
Provide a list of voices known to the server.
|
Vector<MaryClient.Voice> |
getVoices(Locale locale)
Provide a list of voices known to the server for the given locale.
|
protected void |
initialise(boolean profile,
boolean quiet)
Initialise a connection to the MARY server at the specified host and port.
|
abstract boolean |
isHMMEffect(String effectName) |
boolean |
isServerVersionAtLeast(String version) |
static void |
main(String[] args) |
void |
process(String input,
String inputType,
String outputType,
String locale,
String audioType,
String defaultVoiceName,
OutputStream output) |
void |
process(String input,
String inputType,
String outputType,
String locale,
String audioType,
String defaultVoiceName,
OutputStream output,
long timeout) |
void |
process(String input,
String inputType,
String outputType,
String locale,
String audioType,
String defaultVoiceName,
String defaultStyle,
String defaultEffects,
String outputTypeParams,
OutputStream output)
The standard way to call the MARY client when the output is to go to an output stream.
|
void |
process(String input,
String inputType,
String outputType,
String locale,
String audioType,
String defaultVoiceName,
String defaultStyle,
String defaultEffects,
String outputTypeParams,
OutputStream output,
long timeout)
An alternative way to call the MARY client when the output is to go to an output stream, with a timeout.
|
abstract String |
requestDefaultEffectParameters(String effectName) |
String |
requestEffectHelpText(String effectName) |
abstract String |
requestFullEffect(String effectName,
String currentEffectParameters) |
void |
streamAudio(String input,
String inputType,
String locale,
String audioType,
String defaultVoiceName,
String defaultStyle,
String defaultEffects,
AudioPlayer audioPlayer,
MaryClient.AudioPlayerListener listener)
Call the mary client to stream audio via the given audio player.
|
static void |
usage() |
protected MaryFormData data
protected boolean beQuiet
protected boolean doProfile
protected MaryClient() throws IOException
IOException
- if communication with the server failsprotected MaryClient(boolean quiet) throws IOException
IOException
protected MaryClient(Address serverAddress) throws IOException
mary.client.profile
(=true/false) - determines whether profiling (timing) information is calculated;mary.client.quiet
(=true/false) - tells the client not to print any of the normal information to stderr.serverAddress
- the address of the serverIOException
- if communication with the server failsprotected MaryClient(Address serverAddress, boolean profile, boolean quiet) throws IOException
serverAddress
- the address of the serverprofile
- determines whether profiling (timing) information is calculatedquiet
- tells the client not to print any of the normal information to stderrIOException
- if communication with the server failspublic static MaryClient getMaryClient() throws IOException
IOException
public static MaryClient getMaryClient(Address serverAddress) throws IOException
mary.client.profile
(=true/false) - determines whether profiling (timing) information is calculated;mary.client.quiet
(=true/false) - tells the client not to print any of the normal information to stderr.serverAddress
- address of the serverIOException
- if communication with the server failspublic static MaryClient getMaryClient(Address serverAddress, boolean profile, boolean quiet) throws IOException
IOException
protected final void initialise(boolean profile, boolean quiet) throws IOException
profile
- whether to do profilingquiet
- whether to refrain from printing information to stderrIOException
- if communication with the server failspublic Address getAddress()
public String getHost()
public int getPort()
public Vector<String> getAudioFileFormatTypes() throws IOException
extension name
IOException
- IOExceptionpublic Vector<String> getAudioOutTypes() throws IOException
IOException
protected abstract void fillAudioFileFormatAndOutTypes() throws IOException
IOException
protected abstract void fillServerVersion() throws IOException
IOException
public boolean isServerVersionAtLeast(String version) throws IOException
IOException
public Vector<MaryClient.DataType> getAllDataTypes() throws IOException
IOException
- if communication with the server failspublic Vector<MaryClient.DataType> getInputDataTypes() throws IOException
IOException
- if communication with the server failspublic Vector<MaryClient.DataType> getOutputDataTypes() throws IOException
IOException
- if communication with the server failsprotected abstract void fillDataTypes() throws IOException
IOException
public Vector<MaryClient.Voice> getVoices() throws IOException
IOException
- if communication with the server failspublic Vector<MaryClient.Voice> getVoices(Locale locale) throws IOException
locale
- the requested voice localeIOException
- if communication with the server failspublic Vector<MaryClient.Voice> getGeneralDomainVoices() throws IOException
IOException
- if communication with the server failspublic Vector<MaryClient.Voice> getLimitedDomainVoices() throws IOException
IOException
- if communication with the server failspublic Vector<MaryClient.Voice> getGeneralDomainVoices(Locale locale) throws IOException
locale
- the requested voice localeIOException
- if communication with the server failspublic Vector<MaryClient.Voice> getLimitedDomainVoices(Locale locale) throws IOException
locale
- the requested voice localeIOException
- if communication with the server failsprotected abstract void fillVoices() throws IOException
IOException
public Set<Locale> getLocales() throws IOException
IOException
protected abstract void fillLocales() throws IOException
IOException
public Vector<String> getVoiceExampleTextsLimitedDomain(String voicename) throws IOException
voicename
- the voiceIOException
- IOExceptionprotected abstract void fillVoiceExampleTexts(String voicename) throws IOException
IOException
public String getServerExampleText(String dataType, String locale) throws IOException
dataType
- the string representation of the data type, e.g. "RAWMARYXML". This is optional information which is not
required for the normal operation of the client, but may help to avoid incompatibilities.locale
- localeIOException
- if communication with the server failsprotected abstract void fillServerExampleText(String dataType, String locale) throws IOException
IOException
protected abstract String getDefaultAudioEffects() throws IOException
IOException
- IOExceptionpublic String getAudioEffects() throws IOException
IOException
public abstract String requestDefaultEffectParameters(String effectName) throws IOException
IOException
public abstract String requestFullEffect(String effectName, String currentEffectParameters) throws IOException
IOException
public abstract boolean isHMMEffect(String effectName) throws IOException
IOException
public String requestEffectHelpText(String effectName) throws IOException
IOException
protected abstract void fillEffectHelpText(String effectName) throws IOException
IOException
public abstract String getFeatures(String locale) throws IOException
IOException
public abstract String getFeaturesForVoice(String voice) throws IOException
IOException
public void streamAudio(String input, String inputType, String locale, String audioType, String defaultVoiceName, String defaultStyle, String defaultEffects, AudioPlayer audioPlayer, MaryClient.AudioPlayerListener listener) throws IOException
input
- a textual representation of the input datainputType
- the name of the input data type, e.g. TEXT or RAWMARYXML.locale
- localeaudioType
- the name of the audio format, e.g. "WAVE" or "MP3".defaultVoiceName
- the name of the voice to use, e.g. de7 or us1.defaultStyle
- defaultStyledefaultEffects
- defaultEffectsaudioPlayer
- the FreeTTS audio player with which to play the synthesized audio data. The given audio player must already be
instantiated. See the package com.sun.speech.freetts.audio
in FreeTTS for implementations of
AudioPlayer.listener
- a means for letting calling code know that the AudioPlayer has finished.IOException
- if communication with the server failsgetInputDataTypes()
,
getVoices()
public void process(String input, String inputType, String outputType, String locale, String audioType, String defaultVoiceName, String defaultStyle, String defaultEffects, String outputTypeParams, OutputStream output) throws IOException
input
- a textual representation of the input datainputType
- the name of the input data type, e.g. TEXT or RAWMARYXML.outputType
- the name of the output data type, e.g. AUDIO or ACOUSTPARAMS.audioType
- the name of the audio format, e.g. "WAVE" or "MP3".defaultVoiceName
- the name of the voice to use, e.g. de7 or us1.locale
- localedefaultStyle
- defaultStyledefaultEffects
- defaultEffectsoutputTypeParams
- any additional parameters, e.g. for output type TARGETFEATURES, the space-separated list of features to produce.
Can be null.output
- the output stream into which the data from the server is to be written.IOException
- if communication with the server failsgetInputDataTypes()
,
getOutputDataTypes()
,
getVoices()
public void process(String input, String inputType, String outputType, String locale, String audioType, String defaultVoiceName, OutputStream output) throws IOException
IOException
public void process(String input, String inputType, String outputType, String locale, String audioType, String defaultVoiceName, String defaultStyle, String defaultEffects, String outputTypeParams, OutputStream output, long timeout) throws IOException
input
- a textual representation of the input datainputType
- the name of the input data type, e.g. TEXT or RAWMARYXML.outputType
- the name of the output data type, e.g. AUDIO or ACOUSTPARAMS.audioType
- the name of the audio format, e.g. "WAVE" or "MP3".defaultVoiceName
- the name of the voice to use, e.g. de7 or us1.locale
- localedefaultStyle
- defaultStyledefaultEffects
- defaultEffectsoutputTypeParams
- any additional parameters, e.g. for output type TARGETFEATURES, the space-separated list of features to produce.
Can be null.output
- the output stream into which the data from the server is to be written.timeout
- if >0, sets a timer to as many milliseconds; if processing is not finished by then, the connection with the
Mary server is forcefully cut, resulting in an IOException.IOException
- if communication with the server failsgetInputDataTypes()
,
getOutputDataTypes()
,
getVoices()
public void process(String input, String inputType, String outputType, String locale, String audioType, String defaultVoiceName, OutputStream output, long timeout) throws IOException
IOException
protected abstract void _process(String input, String inputType, String outputType, String locale, String audioType, String defaultVoiceName, String defaultStyle, String defaultEffects, Object output, long timeout, boolean streamingAudio, String outputTypeParams, MaryClient.AudioPlayerListener playerListener) throws IOException
IOException
public static AudioFileFormat.Type getAudioFileFormatType(String name)
name
- namepublic static void usage()
public static void main(String[] args) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2000–2016 DFKI GmbH. All rights reserved.