Product Site

7.4.6. BEEP

Sounds the speaker at frequency Hertz for duration milliseconds. The frequency can be any whole number in the range 37 to 32767 Hertz. The duration can be any whole number in the range 0 to 60000 milliseconds.

This routine is most useful when called as a subroutine. A null string is returned.

Notes

On Unix-like systems, to sound the speaker at a specified frequency, a console with ioctl KDMKTONE support must be available, which typically requires root access. If there is no console with KDMKTONE support (e. g. on BSD or Darwin), a bell character is sent to the console instead.

On Windows, beeps may have been deactivated. To check the status of the Windows beep service, use the Service Control Manager command sc qc beep. To permanently enable the system beep service, run the command sc config beep start= auto in a Command window with Administrator rights, and then reboot your system.

Here is an example for Windows:
Example 7.11. Builtin function BEEP
-- C scale
note.1 = 262    -- Do,  middle C
note.2 = 294    -- Re,  D
note.3 = 330    -- Mi,  E
note.4 = 349    -- Fa,  F
note.5 = 392    -- Sol, G
note.6 = 440    -- La,  A
note.7 = 494    -- Si,  B, H
note.8 = 523    -- Do,  C

do i = 1 to 8
  call beep note.i, 250 -- hold each note for 1/4 second
end