|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarytts.client.MaryClient
public abstract class MaryClient
An HTTP client implementing the MARY protocol. It can be used as a command line client or from within java code.
A GUI interface to this client,
Description of the MARY protocol| Nested Class Summary | |
|---|---|
static interface |
MaryClient.AudioPlayerListener
A means of letting a caller code know that the audioplayer has finished. |
class |
MaryClient.AudioPlayerWriter
|
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
|
| Field Summary | |
|---|---|
protected boolean |
beQuiet
|
protected MaryFormData |
data
|
protected boolean |
doProfile
|
| Constructor Summary | |
|---|---|
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)
|
| Method Summary | |
|---|---|
protected abstract void |
_process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
java.lang.Object output,
long timeout,
boolean streamingAudio,
java.lang.String outputTypeParams,
MaryClient.AudioPlayerListener playerListener)
|
protected abstract void |
fillAudioFileFormatAndOutTypes()
|
protected abstract void |
fillDataTypes()
|
protected abstract void |
fillEffectHelpText(java.lang.String effectName)
|
protected abstract void |
fillServerExampleText(java.lang.String dataType,
java.lang.String locale)
|
protected abstract void |
fillServerVersion()
|
protected abstract void |
fillVoiceExampleTexts(java.lang.String voicename)
|
protected abstract void |
fillVoices()
|
Address |
getAddress()
|
java.util.Vector<MaryClient.DataType> |
getAllDataTypes()
Obtain a list of all data types known to the server. |
java.lang.String |
getAudioEffects()
|
static javax.sound.sampled.AudioFileFormat.Type |
getAudioFileFormatType(java.lang.String name)
Return an audio file format type for the given string. |
java.util.Vector<java.lang.String> |
getAudioFileFormatTypes()
Get the audio file format types known by the server, one per line. |
java.util.Vector<java.lang.String> |
getAudioOutTypes()
|
protected abstract java.lang.String |
getDefaultAudioEffects()
Request the available audio effects for a voice from the server |
abstract java.lang.String |
getFeatures(java.lang.String locale)
|
abstract java.lang.String |
getFeaturesForVoice(java.lang.String voice)
|
java.util.Vector<MaryClient.Voice> |
getGeneralDomainVoices()
Provide a list of general domain voices known to the server. |
java.util.Vector<MaryClient.Voice> |
getGeneralDomainVoices(java.util.Locale locale)
Provide a list of general domain voices known to the server. |
java.lang.String |
getHost()
|
java.util.Vector<MaryClient.DataType> |
getInputDataTypes()
Obtain a list of input data types known to the server. |
java.util.Vector<MaryClient.Voice> |
getLimitedDomainVoices()
Provide a list of limited domain voices known to the server. |
java.util.Vector<MaryClient.Voice> |
getLimitedDomainVoices(java.util.Locale locale)
Provide a list of limited domain voices known to the server. |
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)
|
java.util.Vector<MaryClient.DataType> |
getOutputDataTypes()
Obtain a list of output data types known to the server. |
int |
getPort()
|
java.lang.String |
getServerExampleText(java.lang.String dataType,
java.lang.String locale)
Request an example text for a given data type from the server. |
java.util.Vector<java.lang.String> |
getVoiceExampleTextsLimitedDomain(java.lang.String voicename)
Request the example texts of a limited domain unit selection voice from the server |
java.util.Vector<MaryClient.Voice> |
getVoices()
Provide a list of voices known to the server. |
java.util.Vector<MaryClient.Voice> |
getVoices(java.util.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(java.lang.String effectName)
|
boolean |
isServerVersionAtLeast(java.lang.String version)
|
static void |
main(java.lang.String[] args)
|
void |
process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.io.OutputStream output)
|
void |
process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.io.OutputStream output,
long timeout)
|
void |
process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
java.lang.String outputTypeParams,
java.io.OutputStream output)
The standard way to call the MARY client when the output is to go to an output stream. |
void |
process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
java.lang.String outputTypeParams,
java.io.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 java.lang.String |
requestDefaultEffectParameters(java.lang.String effectName)
|
java.lang.String |
requestEffectHelpText(java.lang.String effectName)
|
abstract java.lang.String |
requestFullEffect(java.lang.String effectName,
java.lang.String currentEffectParameters)
|
void |
streamAudio(java.lang.String input,
java.lang.String inputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
AudioPlayer audioPlayer,
MaryClient.AudioPlayerListener listener)
Call the mary client to stream audio via the given audio player. |
static void |
usage()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected MaryFormData data
protected boolean beQuiet
protected boolean doProfile
| Constructor Detail |
|---|
protected MaryClient()
throws java.io.IOException
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
protected MaryClient(boolean quiet)
throws java.io.IOException
java.io.IOException
protected MaryClient(Address serverAddress)
throws java.io.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.
host - the host where to contact a MARY serverport - the socket port where to contact a MARY server
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
protected MaryClient(Address serverAddress,
boolean profile,
boolean quiet)
throws java.io.IOException
host - the host where to contact a MARY serverport - the socket port where to contact a MARY serverprofile - determines whether profiling (timing) information is calculatedquiet - tells the client not to print any of the normal information to stderr
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found| Method Detail |
|---|
public static MaryClient getMaryClient()
throws java.io.IOException
java.io.IOException
public static MaryClient getMaryClient(Address serverAddress)
throws java.io.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.
host - the host where to contact a MARY serverport - the socket port where to contact a MARY server
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
public static MaryClient getMaryClient(Address serverAddress,
boolean profile,
boolean quiet)
throws java.io.IOException
java.io.IOException
protected final void initialise(boolean profile,
boolean quiet)
throws java.io.IOException
serverHost - the host where to contact a MARY serverserverPort - the socket port where to contact a MARY serverprofile - whether to do profilingquiet - whether to refrain from printing information to stderr
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be foundpublic Address getAddress()
public java.lang.String getHost()
public int getPort()
public java.util.Vector<java.lang.String> getAudioFileFormatTypes()
throws java.io.IOException
extension name
java.io.IOException
java.net.UnknownHostException
public java.util.Vector<java.lang.String> getAudioOutTypes()
throws java.io.IOException
java.io.IOException
protected abstract void fillAudioFileFormatAndOutTypes()
throws java.io.IOException
java.io.IOException
protected abstract void fillServerVersion()
throws java.io.IOException
java.io.IOException
public boolean isServerVersionAtLeast(java.lang.String version)
throws java.io.IOException
java.io.IOException
public java.util.Vector<MaryClient.DataType> getAllDataTypes()
throws java.io.IOException
java.lang.Exception - if communication with the server fails
java.io.IOException
public java.util.Vector<MaryClient.DataType> getInputDataTypes()
throws java.io.IOException
java.lang.Exception - if communication with the server fails
java.io.IOException
public java.util.Vector<MaryClient.DataType> getOutputDataTypes()
throws java.io.IOException
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
protected abstract void fillDataTypes()
throws java.io.IOException
java.io.IOException
public java.util.Vector<MaryClient.Voice> getVoices()
throws java.io.IOException
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
public java.util.Vector<MaryClient.Voice> getVoices(java.util.Locale locale)
throws java.io.IOException
locale - the requested voice locale
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
public java.util.Vector<MaryClient.Voice> getGeneralDomainVoices()
throws java.io.IOException
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
public java.util.Vector<MaryClient.Voice> getLimitedDomainVoices()
throws java.io.IOException
java.lang.Exception - if communication with the server fails
java.io.IOException
public java.util.Vector<MaryClient.Voice> getGeneralDomainVoices(java.util.Locale locale)
throws java.io.IOException
locale - the requested voice locale
java.lang.Exception - if communication with the server fails
java.io.IOException
public java.util.Vector<MaryClient.Voice> getLimitedDomainVoices(java.util.Locale locale)
throws java.io.IOException
locale - the requested voice locale
java.lang.Exception - if communication with the server fails
java.io.IOException
protected abstract void fillVoices()
throws java.io.IOException
java.io.IOException
public java.util.Vector<java.lang.String> getVoiceExampleTextsLimitedDomain(java.lang.String voicename)
throws java.io.IOException
voicename - the voice
java.io.IOException
java.net.UnknownHostException
protected abstract void fillVoiceExampleTexts(java.lang.String voicename)
throws java.io.IOException
java.io.IOException
public java.lang.String getServerExampleText(java.lang.String dataType,
java.lang.String locale)
throws java.io.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.
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be found
protected abstract void fillServerExampleText(java.lang.String dataType,
java.lang.String locale)
throws java.io.IOException
java.io.IOException
protected abstract java.lang.String getDefaultAudioEffects()
throws java.io.IOException
voicename - the voice
java.io.IOException
java.net.UnknownHostException
public java.lang.String getAudioEffects()
throws java.io.IOException
java.io.IOException
public abstract java.lang.String requestDefaultEffectParameters(java.lang.String effectName)
throws java.io.IOException
java.io.IOException
public abstract java.lang.String requestFullEffect(java.lang.String effectName,
java.lang.String currentEffectParameters)
throws java.io.IOException
java.io.IOException
public abstract boolean isHMMEffect(java.lang.String effectName)
throws java.io.IOException
java.io.IOException
public java.lang.String requestEffectHelpText(java.lang.String effectName)
throws java.io.IOException
java.io.IOException
protected abstract void fillEffectHelpText(java.lang.String effectName)
throws java.io.IOException
java.io.IOException
public abstract java.lang.String getFeatures(java.lang.String locale)
throws java.io.IOException
java.io.IOException
public abstract java.lang.String getFeaturesForVoice(java.lang.String voice)
throws java.io.IOException
java.io.IOException
public void streamAudio(java.lang.String input,
java.lang.String inputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
AudioPlayer audioPlayer,
MaryClient.AudioPlayerListener listener)
throws java.io.IOException
input - a textual representation of the input datainputType - the name of the input data type, e.g. TEXT or RAWMARYXML.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.audioPlayer - the FreeTTS audio player with which to play the synthesised audio data. The
given audio player must already be instanciated. 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.
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be foundgetInputDataTypes(),
getVoices()
public void process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
java.lang.String outputTypeParams,
java.io.OutputStream output)
throws java.io.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.audioEffects - the audio effects and their parameters to be applied as a post-processing step, e.g. Robot(Amount=100), Whisper(amount=50)outputTypeParams - 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.
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be foundgetInputDataTypes(),
getOutputDataTypes(),
getVoices()
public void process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOException
public void process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
java.lang.String outputTypeParams,
java.io.OutputStream output,
long timeout)
throws java.io.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.audioEffects - the audio effects and their parameters to be applied as a post-processing step, e.g. Robot(Amount=100), Whisper(amount=50)outputTypeParams - 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.
java.io.IOException - if communication with the server fails
java.net.UnknownHostException - if the host could not be foundgetInputDataTypes(),
getOutputDataTypes(),
getVoices()
public void process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.io.OutputStream output,
long timeout)
throws java.io.IOException
java.io.IOException
protected abstract void _process(java.lang.String input,
java.lang.String inputType,
java.lang.String outputType,
java.lang.String locale,
java.lang.String audioType,
java.lang.String defaultVoiceName,
java.lang.String defaultStyle,
java.lang.String defaultEffects,
java.lang.Object output,
long timeout,
boolean streamingAudio,
java.lang.String outputTypeParams,
MaryClient.AudioPlayerListener playerListener)
throws java.io.IOException
java.io.IOExceptionpublic static javax.sound.sampled.AudioFileFormat.Type getAudioFileFormatType(java.lang.String name)
#canCreateMP3(),
#canCreateOgg()public static void usage()
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||