Skip to content

dos_speaker

Dale Fugier edited this page Jul 1, 2026 · 1 revision

Plays a sound out of the PC speaker.

Note, dos_speaker does not work on all systems.

A long time ago, all PC computers shared a common 8254 programmable interval timer chip for the generation of primitive sounds. The dos_speaker function was written specifically to emit a beep on that piece of hardware.

Since then, sound cards have become standard equipment on almost all PC computers. As sound cards became more common, manufacturers began to remove the old timer chip from computers. The chips were also excluded from the design of server computers. The result is that dos_speaker did not work on all computers without the chip. This was okay because most developers had moved on to calling the dos_beep function that uses whatever is the default sound device instead of the 8254 chip.

Syntax

(dos_speaker frequency duration)

Parameters

frequency

The frequency of the sound, in hertz. This parameter must be in the range 37 through 32,767.

duration

The duration of the sound, in milliseconds.

Returns

T if successful.

nil on error.

Example

Command: (dos_speaker 1500 5)
nil

Clone this wiki locally