old-www/HOWTO/Visual-Bell-4.html

52 lines
2.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Visible bell mini-Howto: Per-console Beep Configuration</TITLE>
<LINK HREF="Visual-Bell-5.html" REL=next>
<LINK HREF="Visual-Bell-3.html" REL=previous>
<LINK HREF="Visual-Bell.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="Visual-Bell-5.html">Next</A>
<A HREF="Visual-Bell-3.html">Previous</A>
<A HREF="Visual-Bell.html#toc4">Contents</A>
<HR>
<H2><A NAME="s4">4. Per-console Beep Configuration</A></H2>
<P>As of Linux 1.3.43, Martin Mares added the ability to configure the
pitch and duration of the beep, by modifying <CODE>console.c</CODE>. 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 <CODE>~/.profile</CODE>
or <CODE>~/.login</CODE> file to select a different beep sound associated
to each console (or no beep at all, if needed).
<P>The escape sequences work as follow:
<UL>
<LI>ESC-<CODE>[10;</CODE>xx<CODE>]</CODE> 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-<CODE>[10]</CODE>.</LI>
<LI>ESC-<CODE>[11;</CODE>xx<CODE>]</CODE> 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-<CODE>[11]</CODE>) the default value
will be used.</LI>
</UL>
<P>To select, for example, a 50Hz pitch for one-second duration, you can
"<CODE>echo -e "\\33[10;50]\\33[11;1000]"</CODE>" with <CODE>bash</CODE> (where "-e"
means `understand Escape sequences'. If you use <CODE>tcsh</CODE> the same
command spells "<CODE>echo "\\033[10;50]\\033[11;1000]"</CODE>".
<P>Although I don't know of any version of the <CODE>setterm</CODE> command that
supports such configuration, a future version of the command might
well support a command-line option to configure the bell sound.
<P>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.
<P>
<HR>
<A HREF="Visual-Bell-5.html">Next</A>
<A HREF="Visual-Bell-3.html">Previous</A>
<A HREF="Visual-Bell.html#toc4">Contents</A>
</BODY>
</HTML>