hmi.tts.mary
Class MaryTTSGenerator

java.lang.Object
  extended by hmi.tts.AbstractTTSGenerator
      extended by hmi.tts.mary.MaryTTSGenerator

@ThreadSafe
public class MaryTTSGenerator
extends AbstractTTSGenerator


Field Summary
private  int currentWordOffset
           
private  PhonemeToVisemeMapping visemeMapping
           
private  marytts.modules.synthesis.Voice voice
           
 
Fields inherited from class hmi.tts.AbstractTTSGenerator
bookmarks, callback, permanentCallback, visimes, wordDescriptions
 
Constructor Summary
MaryTTSGenerator(String maryDir)
          Constructor, sets up and starts the Mary TTS generator without a viseme mapping
MaryTTSGenerator(String maryDir, PhonemeToVisemeMapping vm)
          Constructor, sets up and starts the Mary TTS generator
 
Method Summary
private  void addWordDescription(WordDescription wd)
           
private  TimingInfo getAndClearTimingInfo()
           
private  AudioFileFormat getAudioFileFormat()
           
 TimingInfo getBMLTiming(String text)
          Get the timing of a BML speech behavior
 String getMaryXMLStartTag()
           
 String getSSMLStartTag()
           
 TimingInfo getTiming(String text)
          Gets the timing of the text, fills out visime, phoneme,bookmark and word lists
 TimingInfo getTiming(String text, marytts.datatypes.MaryDataType inputDataType)
           
 String[] getVoices()
          Get the duration of the last spoken/timed text
private  void parseBoundary(Node n)
           
private  void parseMark(Node n)
           
private  Phoneme parsePhoneme(Node n, boolean stress)
           
private  void parseSyllable(Node n, List<Phoneme> pList, List<Visime> vList)
           
private  void parseWord(Node n)
           
private  void parseWordDescriptionsAndBookmarks(Document doc)
           
private  void parseWordDescriptionsAndBookmarks(Node node)
           
 void setVoice(String speaker)
          Sets the speaker
 TimingInfo speak(String text)
           
 TimingInfo speak(String text, marytts.datatypes.MaryDataType inputType)
           
 TimingInfo speakBML(String text)
          Speaks out the BML sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists
 TimingInfo speakBMLToFile(String text, String filename)
          Generates a file containing the spoken BML sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists.
private  void speakText(String text, marytts.datatypes.MaryDataType inputType)
           
 TimingInfo speakToFile(String text, String filename)
          Generates a file containing the spoken sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists.
 void speakToFile(String text, String filename, marytts.datatypes.MaryDataType inputType)
           
 
Methods inherited from class hmi.tts.AbstractTTSGenerator
getRate, getVolume, setCallback, setPermanentCallback, setRate, setVolume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

voice

private marytts.modules.synthesis.Voice voice

currentWordOffset

private int currentWordOffset

visemeMapping

private PhonemeToVisemeMapping visemeMapping
Constructor Detail

MaryTTSGenerator

public MaryTTSGenerator(String maryDir)
                 throws Exception
Constructor, sets up and starts the Mary TTS generator without a viseme mapping

Throws:
Exception

MaryTTSGenerator

public MaryTTSGenerator(String maryDir,
                        PhonemeToVisemeMapping vm)
                 throws Exception
Constructor, sets up and starts the Mary TTS generator

Parameters:
maryDir - the directory where Mary is installed and its voices can be found
visemeMappingFile - the location of the phoneme to viseme mapping (e.g., "phoneme2viseme/boss2ikp.xml")
Throws:
Exception
Method Detail

getSSMLStartTag

public String getSSMLStartTag()

getMaryXMLStartTag

public String getMaryXMLStartTag()

getAudioFileFormat

private AudioFileFormat getAudioFileFormat()

speakText

private void speakText(String text,
                       marytts.datatypes.MaryDataType inputType)

speakToFile

public void speakToFile(String text,
                        String filename,
                        marytts.datatypes.MaryDataType inputType)
                 throws IOException
Throws:
IOException

getAndClearTimingInfo

private TimingInfo getAndClearTimingInfo()

speak

public TimingInfo speak(String text)
Specified by:
speak in class AbstractTTSGenerator

speak

public TimingInfo speak(String text,
                        marytts.datatypes.MaryDataType inputType)

speakBML

public TimingInfo speakBML(String text)
Description copied from class: AbstractTTSGenerator
Speaks out the BML sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists

Specified by:
speakBML in class AbstractTTSGenerator
Parameters:
text - the text or script to speak

speakToFile

public TimingInfo speakToFile(String text,
                              String filename)
                       throws IOException
Description copied from class: AbstractTTSGenerator
Generates a file containing the spoken sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists.

Specified by:
speakToFile in class AbstractTTSGenerator
Parameters:
text - the text or script to speak
Throws:
FileNotFoundException
IOException

speakBMLToFile

public TimingInfo speakBMLToFile(String text,
                                 String filename)
                          throws IOException
Description copied from class: AbstractTTSGenerator
Generates a file containing the spoken BML sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists.

Specified by:
speakBMLToFile in class AbstractTTSGenerator
Parameters:
text - the text or script to speak
Throws:
IOException

parsePhoneme

private Phoneme parsePhoneme(Node n,
                             boolean stress)

parseSyllable

private void parseSyllable(Node n,
                           List<Phoneme> pList,
                           List<Visime> vList)

parseWord

private void parseWord(Node n)

addWordDescription

private void addWordDescription(WordDescription wd)

parseMark

private void parseMark(Node n)

parseBoundary

private void parseBoundary(Node n)

parseWordDescriptionsAndBookmarks

private void parseWordDescriptionsAndBookmarks(Node node)

parseWordDescriptionsAndBookmarks

private void parseWordDescriptionsAndBookmarks(Document doc)

getTiming

public TimingInfo getTiming(String text)
Description copied from class: AbstractTTSGenerator
Gets the timing of the text, fills out visime, phoneme,bookmark and word lists

Specified by:
getTiming in class AbstractTTSGenerator
Parameters:
text - the text or script to get the timing of

getTiming

public TimingInfo getTiming(String text,
                            marytts.datatypes.MaryDataType inputDataType)

getBMLTiming

public TimingInfo getBMLTiming(String text)
Description copied from class: AbstractTTSGenerator
Get the timing of a BML speech behavior

Specified by:
getBMLTiming in class AbstractTTSGenerator

setVoice

public void setVoice(String speaker)
Description copied from class: AbstractTTSGenerator
Sets the speaker

Specified by:
setVoice in class AbstractTTSGenerator
Parameters:
speaker - speaker name

getVoices

public String[] getVoices()
Description copied from class: AbstractTTSGenerator
Get the duration of the last spoken/timed text

Specified by:
getVoices in class AbstractTTSGenerator
Returns:
duration in s