Question

I've been doing a captcha script lately and was rather successful with it. However I want to create another script that creates a sound which can be used with the captcha.

E.g. the captcha script generates A2B1FD - and the sound script must be able to read out A, 2, B, 1, F, D. How do I go about doing this?

I know it's something to do with OpenAL but how to I start?

Cheers Sam Yong

EDIT: I also wish to know how can I load the sound file loaded from the script in the browser and play it so that the end-user can hear.

Edit 2: I am also looking at the possibility of Text-to-Speech (platform independant) in PHP

Was it helpful?

Solution

Probably the easiest way would be to record 36 individual audio files of each letter and number, and then have your PHP script concatenate these on-the-fly to deliver a single audio file to the browser.

Here's an example script that uses PHP to concatenate WAV files. In fact, it's for the same purpose - creating a captcha.

Once you've created the unique file for that code, you would just embed it in the browser using standard HTML object and embed techniques.

A tidier method would be to use Flash to do this, but be aware that Flash can hog system resources for the site user - and that can cause problems for visitors using a screen reader as their software can't get enough CPU time to work effectively. Thus you could possibly be defeating the very users you're trying to help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top