hmi.tts.sapi5
Class SAPI5TTSGenerator

java.lang.Object
  extended by hmi.tts.AbstractTTSGenerator
      extended by hmi.tts.sapi5.SAPI5TTSGenerator

@ThreadSafe
public class SAPI5TTSGenerator
extends AbstractTTSGenerator

TTSGenerator for Microsoft SAPI5

Author:
Herwin

Nested Class Summary
private static class SAPI5TTSGenerator.BookMarker
           
 
Field Summary
private  ArrayList<SAPI5TTSGenerator.BookMarker> currentBookmarks
           
private  ArrayList<Phoneme> currentPhonemes
           
private  ArrayList<Visime> currentVisimes
           
private  String currentWord
           
private  int currentWordOffset
           
private  boolean initialized
           
private static org.slf4j.Logger logger
           
private  String text
           
private  boolean wordBeforePhoneme
           
 
Fields inherited from class hmi.tts.AbstractTTSGenerator
bookmarks, callback, permanentCallback, visimes, wordDescriptions
 
Constructor Summary
SAPI5TTSGenerator()
           
 
Method Summary
private  void bookmarkCallback(String bookmark)
           
 void cleanup()
          Destroys the tts generator, it should no longer be used after calling this.
 void finalize()
           
private  TimingInfo getAndClearTimingInfo()
           
 TimingInfo getBMLTiming(String s)
          Get the timing of a BML speech behavior
 TimingInfo getTiming(String text)
          Gets the timing of the text, fills out visime, phoneme,bookmark and word lists
 String[] getVoices()
          Get the duration of the last spoken/timed text
private  void handleBookmarks(WordDescription wd)
           
private  void phonemeCallback(int phoneme, int duration, int nextPhoneme, int stress)
           
private  int SAPICleanup()
           
private  int SAPIDummySpeak(String text)
           
private  String[] SAPIGetVoices()
           
private  int SAPIInit()
           
private  int SAPISetSpeaker(String speaker)
           
private  int SAPISpeak(String text)
           
private  int SAPISpeakToFile(String text, String filename)
           
private  void sentenceBoundryCallback(int offset, int length)
           
 void setVoice(String speaker)
          Sets the speaker
 TimingInfo speak(String str)
           
private  void speak(String str, boolean timeOnly, String filename)
           
 TimingInfo speakBML(String s)
          Speaks out the BML sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists
 TimingInfo speakBMLToFile(String s, String filename)
          Generates a file containing the spoken BML sentence, does the apropiate callbacks, fills out visime, phoneme, bookmark and word lists.
 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.
private  boolean stopCallback()
           
private  void visimeCallback(int visime, int duration, int nextVisime, int stress)
           
private  void wordBoundryCallback(int offset, int length)
           
 
Methods inherited from class hmi.tts.AbstractTTSGenerator
getRate, getVolume, setCallback, setPermanentCallback, setRate, setVolume
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

private boolean initialized

currentBookmarks

private ArrayList<SAPI5TTSGenerator.BookMarker> currentBookmarks

currentVisimes

private ArrayList<Visime> currentVisimes

currentPhonemes

private ArrayList<Phoneme> currentPhonemes

currentWord

private String currentWord

currentWordOffset

private int currentWordOffset

wordBeforePhoneme

private boolean wordBeforePhoneme

text

private String text

logger

private static final org.slf4j.Logger logger
Constructor Detail

SAPI5TTSGenerator

public SAPI5TTSGenerator()
Method Detail

SAPISpeak

private int SAPISpeak(String text)

SAPIDummySpeak

private int SAPIDummySpeak(String text)

SAPIInit

private int SAPIInit()

SAPICleanup

private int SAPICleanup()

SAPISetSpeaker

private int SAPISetSpeaker(String speaker)

SAPISpeakToFile

private int SAPISpeakToFile(String text,
                            String filename)

SAPIGetVoices

private String[] SAPIGetVoices()

cleanup

public void cleanup()
Destroys the tts generator, it should no longer be used after calling this.


finalize

public void finalize()
Overrides:
finalize in class Object

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

setVoice

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

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

speak

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

speak

private void speak(String str,
                   boolean timeOnly,
                   String filename)

phonemeCallback

private void phonemeCallback(int phoneme,
                             int duration,
                             int nextPhoneme,
                             int stress)

visimeCallback

private void visimeCallback(int visime,
                            int duration,
                            int nextVisime,
                            int stress)

bookmarkCallback

private void bookmarkCallback(String bookmark)

handleBookmarks

private void handleBookmarks(WordDescription wd)

wordBoundryCallback

private void wordBoundryCallback(int offset,
                                 int length)

sentenceBoundryCallback

private void sentenceBoundryCallback(int offset,
                                     int length)

stopCallback

private boolean stopCallback()

getAndClearTimingInfo

private TimingInfo getAndClearTimingInfo()

getBMLTiming

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

Specified by:
getBMLTiming in class AbstractTTSGenerator

speakBML

public TimingInfo speakBML(String s)
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:
s - the text or script to speak

speakBMLToFile

public TimingInfo speakBMLToFile(String s,
                                 String filename)
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:
s - the text or script to speak

speakToFile

public TimingInfo speakToFile(String text,
                              String filename)
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

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