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

java.lang.Object
  extended by com.octo.captcha.component.sound.wordtosound.AbstractWordToSound
      extended by com.octo.captcha.component.sound.wordtosound.FreeTTSWordToSound
All Implemented Interfaces:
WordToSound

public class FreeTTSWordToSound
extends AbstractWordToSound
implements WordToSound

WordToSound implementation with FreeTTS an openSource Text To Speech implementation.


Field Summary
static java.lang.String defaultVoiceName
           
static java.lang.String defaultVoicePackage
           
 
Fields inherited from class com.octo.captcha.component.sound.wordtosound.AbstractWordToSound
configurator, maxAcceptedWordLength, minAcceptedWordLength
 
Constructor Summary
FreeTTSWordToSound(SoundConfigurator configurator, int minAcceptedWordLength, int maxAcceptedWordLength)
          Constructor for a FreeTTS implmentation of WordToSound.
 
Method Summary
protected  javax.sound.sampled.AudioInputStream addEffects(javax.sound.sampled.AudioInputStream sound)
          Add effect to the sound
 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 com.octo.captcha.component.sound.wordtosound.AbstractWordToSound
getMaxAcceptedWordLenght, getMaxAcceptedWordLength, getMinAcceptedWordLenght, getMinAcceptedWordLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.octo.captcha.component.sound.wordtosound.WordToSound
getMaxAcceptedWordLenght, getMaxAcceptedWordLength, getMinAcceptedWordLenght, getMinAcceptedWordLength
 

Field Detail

defaultVoiceName

public static java.lang.String defaultVoiceName

defaultVoicePackage

public static java.lang.String defaultVoicePackage
Constructor Detail

FreeTTSWordToSound

public FreeTTSWordToSound(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:
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)

addEffects

protected javax.sound.sampled.AudioInputStream addEffects(javax.sound.sampled.AudioInputStream sound)
Description copied from class: AbstractWordToSound
Add effect to the sound

Specified by:
addEffects in class AbstractWordToSound
Parameters:
sound - The sound to modify
Returns:
The modified sound.
See Also:
AbstractFreeTTSWordToSound.addEffects(javax.sound.sampled.AudioInputStream)

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.