As of Linux 1.3.43, Martin Mares added the ability to configure the
pitch and duration of the beep, by modifying console.c
. Each
console can be configured to feature a different duration and/or pitch
of the bell sound; the task is accomplished by using escape sequences
to the console device. You can configure your own ~/.profile
or ~/.login
file to select a different beep sound associated
to each console (or no beep at all, if needed).
The escape sequences work as follow:
[10;
xx]
selects the bell frequency in Hertz. The value
should be in the range 21-32766, otherwise the result is undefined.
If the `xx' argument is missing, the default value (750Hz) will apply,
as in `ESC-[10]
.[11;
xx]
selects the bell duration, in milli-seconds.
If you specify more than 2 seconds, the default applies (125ms). Once
again, if the `xx' argument is missing (ESC-[11]
) the default value
will be used.To select, for example, a 50Hz pitch for one-second duration, you can
"echo -e "\\33[10;50]\\33[11;1000]"
" with bash
(where "-e"
means `understand Escape sequences'. If you use tcsh
the same
command spells "echo "\\033[10;50]\\033[11;1000]"
".
Although I don't know of any version of the setterm
command that
supports such configuration, a future version of the command might
well support a command-line option to configure the bell sound.
If you run Linux-1.3.43 or newer, you may be satisfied with the escape sequences and avoid reading further. If you run an older kernel, or if you want the visual bell, you'll enjoy the rest of this document.