com.octo.captcha.component.sound.wordtosound
Class AbstractFreeTTSWordToSound

java.lang.Object
  extended by com.octo.captcha.component.sound.wordtosound.AbstractFreeTTSWordToSound
All Implemented Interfaces:
WordToSound
Direct Known Subclasses:
CleanFreeTTSWordToSound

public abstract class AbstractFreeTTSWordToSound
extends java.lang.Object
implements WordToSound

WordToSound implementation with FreeTTS an openSource Text To Speech implementation.


Field Summary
static java.lang.String defaultVoiceName
           
static java.lang.String defaultVoicePackage
           
 
Constructor Summary
AbstractFreeTTSWordToSound()
          Deprecated.  
AbstractFreeTTSWordToSound(SoundConfigurator configurator, int minAcceptedWordLength, int maxAcceptedWordLength)
          Constructor for a FreeTTS implmentation of WordToSound.
 
Method Summary
protected abstract  javax.sound.sampled.AudioInputStream addEffects(javax.sound.sampled.AudioInputStream sound)
           
 int getMaxAcceptedWordLenght()
          Deprecated. misspelled, use getMaxAcceptedWordLength() instead
 int getMaxAcceptedWordLength()
           
 int getMinAcceptedWordLenght()
          Deprecated. misspelled, use getMinAcceptedWordLength() instead
 int getMinAcceptedWordLength()
           
 javax.sound.sampled.AudioInputStream getSound(java.lang.String word)
          Main method for this service Return a sound with the specified word
 javax.sound.sampled.AudioInputStream getSound(java.lang.String word, java.util.Locale locale)
          Main method for this service Return a sound with the specified word and Locale, depending on the local a sound is not the same.
 javax.sound.sampled.AudioInputStream stringToSound(java.lang.String sentence)
          Main method for this service Return an image with the specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultVoiceName

public static java.lang.String defaultVoiceName

defaultVoicePackage

public static java.lang.String defaultVoicePackage
Constructor Detail

AbstractFreeTTSWordToSound

public AbstractFreeTTSWordToSound()
Deprecated. 

Constructor


AbstractFreeTTSWordToSound

public AbstractFreeTTSWordToSound(SoundConfigurator configurator,
                                  int minAcceptedWordLength,
                                  int maxAcceptedWordLength)
Constructor for a FreeTTS implmentation of WordToSound. This constructor imply that WordToSound only use one voice define by voiceName, with its own locale

Parameters:
configurator - Voice configuration
minAcceptedWordLength - Length Minimal of generated words
maxAcceptedWordLength - Length Maximal of generated words
Method Detail

getSound

public javax.sound.sampled.AudioInputStream getSound(java.lang.String word)
                                              throws CaptchaException
Description copied from interface: WordToSound
Main method for this service Return a sound with the specified word

Specified by:
getSound in interface WordToSound
Parameters:
word - The word to tranform into sound
Returns:
the generated sound
Throws:
CaptchaException - if word is invalid or an exception occurs during the sound generation
See Also:
WordToSound.getSound(java.lang.String)

getSound

public javax.sound.sampled.AudioInputStream getSound(java.lang.String word,
                                                     java.util.Locale locale)
                                              throws CaptchaException
Description copied from interface: WordToSound
Main method for this service Return a sound with the specified word and Locale, depending on the local a sound is not the same. This is a big difference with an image.

Specified by:
getSound in interface WordToSound
Parameters:
word - The word to tranform into sound
locale - Locale for the sound
Returns:
the generated sound
Throws:
CaptchaException - if word is invalid or an exception occurs during the sound generation
See Also:
WordToSound.getSound(String, java.util.Locale)

getMaxAcceptedWordLength

public int getMaxAcceptedWordLength()
Specified by:
getMaxAcceptedWordLength in interface WordToSound
Returns:
the max word length accepted by this word2image service

getMinAcceptedWordLength

public int getMinAcceptedWordLength()
Specified by:
getMinAcceptedWordLength in interface WordToSound
Returns:
the min word length accepted by this word2image service

getMaxAcceptedWordLenght

public int getMaxAcceptedWordLenght()
Deprecated. misspelled, use getMaxAcceptedWordLength() instead

Specified by:
getMaxAcceptedWordLenght in interface WordToSound
Returns:
the max word lenght accepted by this word2image service

getMinAcceptedWordLenght

public int getMinAcceptedWordLenght()
Deprecated. misspelled, use getMinAcceptedWordLength() instead

Specified by:
getMinAcceptedWordLenght in interface WordToSound
Returns:
the min word lenght accepted by this word2image service

addEffects

protected abstract javax.sound.sampled.AudioInputStream addEffects(javax.sound.sampled.AudioInputStream sound)

stringToSound

public javax.sound.sampled.AudioInputStream stringToSound(java.lang.String sentence)
                                                   throws CaptchaException
Main method for this service Return an image with the specified. Synchronisation is very important, for multi threading execution

Parameters:
sentence - Written sentece to transform into speech
Returns:
the generated sound
Throws:
CaptchaException - if word is invalid or an exception occurs during the sound generation


Copyright 2003-2009 JCaptcha. All Rights Reserved.