bells -- Provide audible alarm bells.


package require bells

bells %AUTO% | name ?options...?

abell configure ?options...?

abell cget option

abell start

abell cancel

abell destroy


This package provides a snit::type named bell. Instances of bell produce repeating patterns of beeps. Typically this is used to alert users to conditions of alarm level severity.

Bells have a -pattern which determines the interval between each beep, and an -interval which determines the time between repetitions of the pattern.


-interval msec

Determines the time in milliseconds between repetitions of the beep pattern. If not supplied, this defaults to 1000 (one second). In the interval between patterns, the event loop is active.

-pattern msec1 ...

Determines the interval between beeps in one repetition of the pattern. The pattern begins with a beep after which there is a delay that is determined by iterating through the -pattern list after which another beep is emitted.

The default is a single element of 100 which results in a double beep with the two beeps separated by 0.1 seconds.

Note that during the execution of the pattern, the event loop does not execute.


Instances of a bell are created using the bell command and, themselves become commands. The ways to create a bell command are:

bell bellname ?options...?
set somevar [bell %AUTO% ?options...?]

The first example defines the command bellname to represent an object of type bell. The second example lets the bell command select a unique command name and assigns it to he variable somevar

In all cases the remainder of the command (if any) is made up of option-value pairs which override the default options (See OPTIONS above).

Once created, the command representing the object can be used to invoke several subcommands (Methods) on the bell object. These are listed and described below:


Destroys the object. Once this is done, the command that represents the objecdt is no longer defined

configure options...

Change the configuration options for the object. If the bell is currently in the process of ringing, the options are changed and will take effect at the end of the current pattern. See OPTIONS above.

cget optname

Returns the value of the configuration option optname. See OPTIONS above for a list of the legal option names.


Starts repetition of the bell pattern. Once started, the pattern will continue as defined by the OPTIONS until the program exits, the bell object is destroyed or the cancel method is invoked.


Cancels the executing pattern. If the pattern is not executing, this is a no-op.


This example shows the full lifecycle of a bell object. In this case, the bell is configured to repeat every second, with a pattern of two short (50ms) delays and one long (100ms) delay.

Example 1. bell example

set abell [bell %AUTO% -pattern [list 50 50 100] -interval 1000]
$abell start;
$abell cancel
$abell destroy