27.7 Changing the Bell Sound
You can now change how the audible bell sounds using the variable
`sound-alist''s value is an list associating symbols with, among
other things, strings of audio-data. When `ding' is called with one of
the symbols, the associated sound data is played instead of the
standard beep. This only works if you are logged in on the console of a
machine with audio hardware. To listen to a sound of the provided type,
call the function `play-sound' with the argument SOUND. You can also
set the volume of the sound with the optional argument VOLUME.
Each element of `sound-alist' is a list describing a sound. The
first element of the list is the name of the sound being defined.
Subsequent elements of the list are alternating keyword/value pairs:
A string of raw sound data, or the name of another sound to play.
The symbol `t' here means use the default X beep.
An integer from 0-100, defaulting to `bell-volume'.
If using the default X beep, the pitch (Hz) to generate.
If using the default X beep, the duration (milliseconds).
For compatibility, elements of `sound-alist' may also be of the form:
( SOUND-NAME . <SOUND> )
( SOUND-NAME <VOLUME> <SOUND> )
You should probably add things to this list by calling the function
Note that you can only play audio data if running on the console
screen of a machine with audio hardware which emacs understands, which
at this time means a Sun SparcStation, SGI, or HP9000s700.
Also note that the pitch, duration, and volume options are available
everywhere, but most X servers ignore the `pitch' option.
The variable `bell-volume' should be an integer from 0 to 100, with
100 being loudest, which controls how loud the sounds emacs makes
should be. Elements of the `sound-alist' may override this value.
This variable applies to the standard X bell sound as well as sound
If the symbol `t' is in place of a sound-string, Emacs uses the
default X beep. This allows you to define beep-types of different
volumes even when not running on the console.
You can add things to this list by calling the function
`load-sound-file', which reads in an audio-file and adds its data to
the sound-alist. You can specify the sound with the SOUND-NAME argument
and the file into which the sounds are loaded with the FILENAME
argument. The optional VOLUME argument sets the volume.
`load-sound-file (FILENAME SOUND-NAME &optional VOLUME)'
To load and install some sound files as beep-types, use the function
`load-default-sounds' (note that this only works if you are on display
0 of a machine with audio hardware).
The following beep-types are used by Emacs itself. Other Lisp
packages may use other beep types, but these are the ones that the C
kernel of Emacs uses.
An auto-save does not succeed
The Emacs command loop catches an error
You type a key that is undefined
You use an undefined mouse-click combination
Completion was not possible
You type something other than the required `y' or `n'
You type something other than `yes' or `no'
automatically generated by info2www version 188.8.131.52