marytts.modules.synthesis
Class Voice

java.lang.Object
  extended by marytts.modules.synthesis.Voice
Direct Known Subclasses:
HMMVoice, InterpolatingVoice, MbrolaVoice, UnitSelectionVoice

public class Voice
extends java.lang.Object

A helper class for the synthesis module; each Voice object represents one available voice database.

Author:
Marc Schröder

Nested Class Summary
static class Voice.Gender
           
 
Field Summary
protected  java.util.Map<java.lang.String,Model> acousticModels
           
static javax.sound.sampled.AudioFormat AF16000
          Audio format: 16kHz,16bit,mono, native byte order
static javax.sound.sampled.AudioFormat AF16000BE
          Audio format: 16kHz,16bit,mono, big endian
static javax.sound.sampled.AudioFormat AF22050
          Audio format: 22.05kHz,16bit,mono, native byte order
protected  DirectedGraph durationGraph
           
protected  FeatureFileReader f0ContourFeatures
           
protected  DirectedGraph f0Graph
           
static Voice.Gender FEMALE
          Gender: female.
protected static org.apache.log4j.Logger logger
           
static Voice.Gender MALE
          Gender: male.
 
Constructor Summary
Voice(java.lang.String[] nameArray, java.util.Locale locale, javax.sound.sampled.AudioFormat dbAudioFormat, WaveformSynthesizer synthesizer, Voice.Gender gender)
           
 
Method Summary
 javax.sound.sampled.AudioFormat dbAudioFormat()
           
 Voice.Gender gender()
           
 java.util.Map<java.lang.String,Model> getAcousticModels()
          Get the acoustic models defined for this voice.
 Allophone getAllophone(java.lang.String phoneSymbol)
          Get the Allophone set for the given phone symbol.
 AllophoneSet getAllophoneSet()
          Get the allophone set associated with this voice.
static java.util.Collection<Voice> getAvailableVoices()
          Get the list of all available voices.
static java.util.Collection<Voice> getAvailableVoices(java.util.Locale locale)
          Get the list of all available voices for a given locale.
static java.util.Collection<Voice> getAvailableVoices(WaveformSynthesizer synth)
          Get the list of all available voices for a given waveform synthesizer.
static java.util.Collection<Voice> getAvailableVoices(WaveformSynthesizer synth, java.util.Locale locale)
          Get the list of all available voices for a given waveform synthesizer and locale.
 Model getBoundaryModel()
          Get the boundary duration model for this voice.
static Voice getDefaultVoice(java.util.Locale locale)
           
 DirectedGraph getDurationGraph()
           
 Model getDurationModel()
          Get the duration model for this voice.
 FeatureFileReader getF0ContourFeatures()
           
 DirectedGraph getF0Graph()
           
 Model getF0Model()
          Get the F0 model for this voice.
 com.sun.speech.freetts.lexicon.Lexicon getLexicon()
          Return the lexicon associated to this voice
 java.util.Locale getLocale()
           
 java.lang.String getName()
          Return the name of this voice.
 java.util.Map<java.lang.String,Model> getOtherModels()
          Return any "other" acoustic models that we have.
 java.util.Vector<MaryModule> getPreferredModulesAcceptingType(MaryDataType type)
           
static Voice getSuitableVoice(MaryData d)
           
 VocalizationSynthesizer getVocalizationSynthesizer()
           
static Voice getVoice(org.w3c.dom.Element voiceElement)
           
static Voice getVoice(java.util.Locale locale, Voice.Gender gender)
           
static Voice getVoice(java.lang.String name)
          Get the voice with the given name, or null if there is no voice with that name.
 boolean hasName(java.lang.String name)
           
 boolean hasVocalizationSupport()
           
static void registerVoice(Voice voice)
          Register the given voice.
 javax.sound.sampled.AudioInputStream synthesize(java.util.List<org.w3c.dom.Element> tokensAndBoundaries, java.lang.String outputParams)
          Synthesize a list of tokens and boundaries with the waveform synthesizer providing this voice.
 WaveformSynthesizer synthesizer()
           
 java.lang.String toString()
          Returns the return value of getName().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MALE

public static final Voice.Gender MALE
Gender: male.


FEMALE

public static final Voice.Gender FEMALE
Gender: female.


AF16000

public static final javax.sound.sampled.AudioFormat AF16000
Audio format: 16kHz,16bit,mono, native byte order


AF16000BE

public static final javax.sound.sampled.AudioFormat AF16000BE
Audio format: 16kHz,16bit,mono, big endian


AF22050

public static final javax.sound.sampled.AudioFormat AF22050
Audio format: 22.05kHz,16bit,mono, native byte order


logger

protected static org.apache.log4j.Logger logger

durationGraph

protected DirectedGraph durationGraph

f0Graph

protected DirectedGraph f0Graph

f0ContourFeatures

protected FeatureFileReader f0ContourFeatures

acousticModels

protected java.util.Map<java.lang.String,Model> acousticModels
Constructor Detail

Voice

public Voice(java.lang.String[] nameArray,
             java.util.Locale locale,
             javax.sound.sampled.AudioFormat dbAudioFormat,
             WaveformSynthesizer synthesizer,
             Voice.Gender gender)
      throws MaryConfigurationException
Throws:
MaryConfigurationException
Method Detail

getAllophoneSet

public AllophoneSet getAllophoneSet()
Get the allophone set associated with this voice.

Returns:

getAllophone

public Allophone getAllophone(java.lang.String phoneSymbol)
Get the Allophone set for the given phone symbol.

Parameters:
phoneSymbol -
Returns:
an Allophone object if phoneSymbol is a known phone symbol in the voice's AllophoneSet, or null.

getPreferredModulesAcceptingType

public java.util.Vector<MaryModule> getPreferredModulesAcceptingType(MaryDataType type)

hasName

public boolean hasName(java.lang.String name)

getName

public java.lang.String getName()
Return the name of this voice. If the voice has several possible names, the first one is returned.


toString

public java.lang.String toString()
Returns the return value of getName().

Overrides:
toString in class java.lang.Object

getLocale

public java.util.Locale getLocale()

dbAudioFormat

public javax.sound.sampled.AudioFormat dbAudioFormat()

synthesizer

public WaveformSynthesizer synthesizer()

gender

public Voice.Gender gender()

hasVocalizationSupport

public boolean hasVocalizationSupport()

getVocalizationSynthesizer

public VocalizationSynthesizer getVocalizationSynthesizer()

synthesize

public javax.sound.sampled.AudioInputStream synthesize(java.util.List<org.w3c.dom.Element> tokensAndBoundaries,
                                                       java.lang.String outputParams)
                                                throws SynthesisException
Synthesize a list of tokens and boundaries with the waveform synthesizer providing this voice.

Parameters:
outputParams -
Throws:
SynthesisException

getLexicon

public com.sun.speech.freetts.lexicon.Lexicon getLexicon()
Return the lexicon associated to this voice

Returns:

getDurationGraph

public DirectedGraph getDurationGraph()

getF0Graph

public DirectedGraph getF0Graph()

getF0ContourFeatures

public FeatureFileReader getF0ContourFeatures()

getAcousticModels

public java.util.Map<java.lang.String,Model> getAcousticModels()
Get the acoustic models defined for this voice.

Returns:
a Map mapping model names to models, or null if there are no such models.

getDurationModel

public Model getDurationModel()
Get the duration model for this voice.

Returns:
the model, or null if no such model is defined.

getF0Model

public Model getF0Model()
Get the F0 model for this voice.

Returns:
the model, or null if no such model is defined.

getBoundaryModel

public Model getBoundaryModel()
Get the boundary duration model for this voice.

Returns:
the model, or null if no such model is defined.

getOtherModels

public java.util.Map<java.lang.String,Model> getOtherModels()
Return any "other" acoustic models that we have. Other models are acoustic models beyond duration, F0 and boundary.

Returns:
a Map mapping the model name to the model, or null if no other models exist.

registerVoice

public static void registerVoice(Voice voice)
Register the given voice. It will be contained in the list of available voices returned by any subsequent calls to getAvailableVoices(). If the voice has the highest value of wantToBeDefault for its locale it will be registered as the default voice for its locale. This value is set in the config file setting voice.(name).want.to.be.default.voice.


getVoice

public static Voice getVoice(java.lang.String name)
Get the voice with the given name, or null if there is no voice with that name.

Parameters:
name -
Returns:

getAvailableVoices

public static java.util.Collection<Voice> getAvailableVoices()
Get the list of all available voices. The iterator of the collection returned will return the voices in decreasing order of their "wantToBeDefault" value.


getAvailableVoices

public static java.util.Collection<Voice> getAvailableVoices(java.util.Locale locale)
Get the list of all available voices for a given locale. The iterator of the collection returned will return the voices in decreasing order of their "wantToBeDefault" value.

Parameters:
locale -
Returns:
a collection of Voice objects, or an empty collection if no voice is available for the given locale.

getAvailableVoices

public static java.util.Collection<Voice> getAvailableVoices(WaveformSynthesizer synth)
Get the list of all available voices for a given waveform synthesizer. The iterator of the collection returned will return the voices in decreasing order of their "wantToBeDefault" value.

Returns:
a collection of Voice objects, or an empty collection if no voice is available for the given waveform synthesizer.

getAvailableVoices

public static java.util.Collection<Voice> getAvailableVoices(WaveformSynthesizer synth,
                                                             java.util.Locale locale)
Get the list of all available voices for a given waveform synthesizer and locale. The iterator of the collection returned will return the voices in decreasing order of their "wantToBeDefault" value.

Returns:
a collection of Voice objects, or an empty collection if no voice is available for the given locale.

getVoice

public static Voice getVoice(java.util.Locale locale,
                             Voice.Gender gender)

getVoice

public static Voice getVoice(org.w3c.dom.Element voiceElement)

getDefaultVoice

public static Voice getDefaultVoice(java.util.Locale locale)

getSuitableVoice

public static Voice getSuitableVoice(MaryData d)