Table of Contents

ugBASIC User Manual

BELL

SYNTAX

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

PURPOSE

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

EXAMPLE

  BELL 42
  BELL #42 ON #%001

ABBREVIATION

 Bel

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY