Available on: d32 vic20 c64 atari atarixl to8 c128 coleco plus4 pc128op d64 mo5 cpc pc1403 coco msx1

BELL

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).

SYNTAX

 BELL
 BELL note
 BELL note, duration
 BELL note, duration ON channels


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

 BELL 42
 BELL #42 ON #%001


ABBREVIATION: Bel

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:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

BELL ↔ Bel

Any problem?

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