Re: git: 225639e7db68 - main - vt: Disable bell by default

From: Warner Losh <>
Date: Fri, 22 Oct 2021 04:55:00 UTC
On Thu, Oct 21, 2021 at 9:17 PM Alexey Dokuchaev <> wrote:

> On Thu, Oct 21, 2021 at 01:52:26PM -0600, Warner Losh wrote:
> > This discussion to date has been data free. I created a poll...
> >
> >
> You couldn't use neutral wording, could you?  The poll is loaded
> with bias, this is not the way to collect answers.  FWIW, FreeBSD
> itself does not make "loud, annoying noise", it simply instructs
> the underlying hardware to beep.  You've asked if people enjoy
> loud, annoying beeps -- well, nobody does, but that's not what
> we're discussing here.

FreeBSD controls the pitch and duration of the noise. And there's
at least one bug in it.

It looks like we want 800Hz:

#define VT_BELLPITCH 800

But we ring the bell with

        sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION);

which looks almost sane. 1.193182MHz is the clock frequency
of the IBM PC PIT square wave generator. And normally it's programmed
by dividing this base clock by the desired clock. So we're passing
in 1491 into sysbeep. We have a tuneable for the 8254 frequency that
the PIT uses, so it's a bug that we're ignoring that and hard coding this

Now, sysbeep is only defined on x86, where this is
otherwise it's nothing. So, timer_spkr_setfreq looks like:
        freq = i8254_freq / freq;
        outb(TIMER_CNTR2, freq & 0xff);
        outb(TIMER_CNTR2, freq >> 8);
so this computation means we are actually playing a 1491Hz tone for 50ms.
You can verify this will be the frequency with any PC speaker tutorial.

This corresponds to no natural note in western music. F#6 is 1480Hz and F6
is 1397Hz. So the tone that's generated is a dissonant note. C4 is middle C,
so this is two octaves higher and a little bit.

Even the 800Hz is between G5 and G5#. Not a great note, but at least
it's an octave lower. So even the desired beep is dissonant.

Since most people find music pleasing, that makes it objectively annoying.
A similar analysis for the other common tunings (where A4 is one of 432,
438, 440 (the most common these days), 442, 444, and 446Hz) yields
similar results with varying degrees of subtonal dissonance.

Also, 50ms is 1/20th of a second (give of take), which translates to about
600 beats per minute, which is annoyingly fast, as any musician would
tell you. The only saving grace is that it's done only once.

Also, the poll is running 4 to 1 for silence by default. While any bias in
wording mighthave pushed it a little one way or the other, when it's this
lopsided it's hard to argue that such bias affected the actual outcome. Our
users aren't so unsophisticated as to be totally swayed by the choice of
wording. The reply tweets suggest people know exactly what I'm talking
about. Iknow it isn't scientific, but it is highly suggestive given the 60
point spread. Even had I used differentwording, my followers on twitter
are self selecting which is likely a biggersource of error, and lord knows
what Twitter's algorithms do to distort who sees it. And likely a dozen
factors I've not even thought of.


P.S. We likely should fix this bug, and also change the note to 880, which
A5 (the second A above middle C). Please see

for a fix for the bug I found here.