The BELL
command makes the computer emit a sound, usually a short beep,
through the internal speaker or audio chipset. This sound serves as an
acoustic signal to the user, indicating that an action has been completed,
reporting an error, or simply to attract attention.
It can be used alone, or specifying characteristics of the sound to be produced.
When you use BELL
with parameters, ugBASIC generates a sine wave with the
frequency specified by the value
, and of duration
length.
The higher the value, the higher the pitch. The greater duration
, the
greater time the sound will last.
The ability to specify the frequency opens up many creative possibilities: by combining
several BELL
commands with different frequencies, you can create short melodies;
you could simulate the sounds of explosions, pops, or other effects, depending on
the frequency and duration of the sound; you can create specific beeps to indicate
different conditions or events in your program.
The supported frequency range may vary depending on the hardware of target computer.
Typically, the duration of the sound produced by BELL
is short and can be
controlled by another, additional, parameter. Moreover, you can select a specific
channel for audio output.
Executing the command may or may not interrupt program execution, depending on the
setting of DEFINE AUDIO SYNC
. Not all targets support all settings (synchronous
and asynchronous).
BELL BELL note BELL note, duration BELL note, duration ON channels
BELL 42 BELL #42 ON #%001
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
BELL ↔ Bel
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS