Audio File Settings

Adding Background Noise

To prevent attackers from deciphering the captcha audio, background noise can be added to improve security. Securimage comes with some audio files containing background noise, mostly crowds of people in busy settings.

The files containing background noise should be longer than the time it takes to read a a captcha code aloud. Most of the default files are roughly 1 minute long. A random slice of the file will be used when adding background noise. If the end portion of a noise file is used as the starting point, it will wrap around to the beginning of the file to fill the remaining duration of the captcha audio.

The default setting for $use_audio_noise is true. If for performance reasons you wish to disable this setting, change its value to false. This setting can be changed in securimage.php or on a per-script basis in your securimage_play.php file.

public $use_audio_noise = true;

Degrading Audio Quality

To prevent speech recognition libraries from picking up the captcha audio, in addition to the background noise, audio quality can be degraded to add random noise to the wav audio signal. The default setting is true and this can be disabled by chaning the $degrade_audio option.

public $degrade_audio = true;

Audio Gap Length

If necessary, a time gap after reading each character in the captcha audio can be inserted to slow down the reading or add randomness. The gap is chosen randomly between $audio_gap_min and $audio_gap_max milliseconds.

public $audio_gap_min = 0;  // minimum 0 millisecond delay between letters

public $audio_gap_max = 600; // maximum 600 millisecond delay between letters

Changing language files

It is possible to read the characters from the captcha audio in a language other than English. First, check the download page to see if a translation in your language is available. If not, you can create your own; see creating audio files for more details.

The $audio_path option is used to change the directory Securimage uses for audio files.

// default audio path = '/securimage/audio/en/'
public $audio_path = '/home/yoursite/public_html/securimage/audio/en/';

// or in securimage_play.php
$img = new Securimage();
$img->audio_path = $img->securimage_path . '/audio/de/'; // switch to German

MP3 Format

Starting with Securimage 3.6, audio files can be output in MP3 format (see the HTML5 audio documentation for more).

The securimage_play.php script is configured by default to output in MP3 format (if LAME is installed) when the format=mp3 query string parameters are set (e.g.

If you have LAME installed and you only want to support MP3 audio, simply change the following line in securimage_play.php from:




Removing Audio Support

If you wish not to support audio playback of captchas, it might be a good idea to delete the files to prevent abuse.

To disable audio support, simply delete securimage_play.php from the securimage directory.

If you are using Securimage::getCaptchaHtml() to render your captcha, set the show_audio_button option to false:

$options = array('show_audio_button' => false');
echo Securimage::getCaptchaHtml($options);