Note that jCaptcha depends on FreeTTS for sound. Here are the steps to setup FreeTTS for jCaptcha.
- Download and unzip jCaptcha. I used 1.2.2.
- Run jcaptcha.exe in /lib
- Copy all jars to your jCaptcha project classpath
- Set system property directly. This saves the trouble to mess with FreeTTS configuration.
String voiceClasses = System.getProperty("freetts.voices"); // another one "freetts.voicesfile"
if (voiceClasses == null) {
System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
voiceClasses = System.getProperty("freetts.voices");
}
log.info("freetts.voices:" + voiceClasses);
String bundle = "toddlist";
DictionaryReader reader = new FileDictionary(bundle);
WordGenerator generator = new DictionaryWordGenerator(reader);
SoundConfigurator soundConfig = new FreeTTSSoundConfigurator("kevin16", VOICE_PACKAGE, 1.0f, 100, 100);
WordToSound word2sound = new FreeTTSWordToSound(soundConfig, 3, 6);
CaptchaFactory[] factories = new CaptchaFactory[]{new GimpySoundFactory(generator, word2sound)};
CaptchaEngine captchaEngine = new GenericCaptchaEngine(factories);
instance = new GenericManageableCaptchaService(captchaEngine, 180,
180000, 75000);
With these limitations, my code compiled and passed the unit tests. Now this is the part one of the story. Stayed tuned for part 2.
Hi ZL,
ReplyDeleteI am working on Image/ Audio Captcha.Can you please provide me the code for that.
It will be highly appreciable
Thanks
Saurabh