GateIn Audio Captcha

Version 4


    Work in progress



    Since GateIn 3.2, we've used gatein simplecaptcha for register portlet, this project is forked from simplecaptcha. However, we only forked image part in the project.

    In fact, visually impaired people may not be able to solve the Captcha challenge. We need do something to integrate audio captcha on this. We forked packages simplecaptcha audio into GateIn simplecaptcha and modified a bit to work on GateIn.





    We have a audio captcha builder same as image captcha. The code example create a audio captcha:


         AudioCaptcha audioCaptcha = new AudioCaptcha.Builder().addVoice().addAnswer().build();

         // addVoice() make a voice

         // addAnswer() make answer to validate



    Look into CaptchaServletUtil.writeAudio which to write audio captcha to output stream:


         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);

         AudioSystem.write(sample.getAudioInputStream(), AudioFileFormat.Type.WAVE, baos);





    With sample is sound sample store in AudioCaptcha after build and can get by:


         Sample sample = audiocaptcha.getChallenge();    


    For validate answer:


         String answer = getAnswer();

         //getAnswer() a whatever method get answer from client

         if(audiocaptcha.isCorrect(answer)) {






    The forked simplecaptcha project can [checkout here|] and [sample portlet here|]. Thanks to James Childrens (Simplecaptcha's author) and {user:username=ndkhoiits}