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

From: Gleb Smirnoff <>
Date: Fri, 22 Oct 2021 17:31:45 UTC

sorry for top quoting. I love this email very much :) Can we please
improve the tone of the bell?

On Thu, Oct 21, 2021 at 10:55:00PM -0600, Warner Losh wrote:
W> FreeBSD controls the pitch and duration of the noise. And there's
W> at least one bug in it.
W> It looks like we want 800Hz:
W> #define VT_BELLPITCH 800
W> But we ring the bell with
W>         sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION);
W> which looks almost sane. 1.193182MHz is the clock frequency
W> of the IBM PC PIT square wave generator. And normally it's programmed
W> by dividing this base clock by the desired clock. So we're passing
W> in 1491 into sysbeep. We have a tuneable for the 8254 frequency that
W> the PIT uses, so it's a bug that we're ignoring that and hard coding this
W> value.
W> Now, sysbeep is only defined on x86, where this is
W> timer_spkr_setfreq(pitch);
W> otherwise it's nothing. So, timer_spkr_setfreq looks like:
W>         freq = i8254_freq / freq;
W>         outb(TIMER_CNTR2, freq & 0xff);
W>         outb(TIMER_CNTR2, freq >> 8);
W> so this computation means we are actually playing a 1491Hz tone for 50ms.
W> You can verify this will be the frequency with any PC speaker tutorial.
W> This corresponds to no natural note in western music. F#6 is 1480Hz and F6
W> is 1397Hz. So the tone that's generated is a dissonant note. C4 is middle C,
W> so this is two octaves higher and a little bit.
W> Even the 800Hz is between G5 and G5#. Not a great note, but at least
W> it's an octave lower. So even the desired beep is dissonant.
W> Since most people find music pleasing, that makes it objectively annoying.
W> A similar analysis for the other common tunings (where A4 is one of 432,
W> 436,
W> 438, 440 (the most common these days), 442, 444, and 446Hz) yields
W> similar results with varying degrees of subtonal dissonance.
W> Also, 50ms is 1/20th of a second (give of take), which translates to about
W> 600 beats per minute, which is annoyingly fast, as any musician would
W> tell you. The only saving grace is that it's done only once.
W> Also, the poll is running 4 to 1 for silence by default. While any bias in
W> wording mighthave pushed it a little one way or the other, when it's this
W> lopsided it's hard to argue that such bias affected the actual outcome. Our
W> users aren't so unsophisticated as to be totally swayed by the choice of
W> wording. The reply tweets suggest people know exactly what I'm talking
W> about. Iknow it isn't scientific, but it is highly suggestive given the 60
W> point spread. Even had I used differentwording, my followers on twitter
W> are self selecting which is likely a biggersource of error, and lord knows
W> what Twitter's algorithms do to distort who sees it. And likely a dozen
W> other
W> factors I've not even thought of.
W> Warner
W> P.S. We likely should fix this bug, and also change the note to 880, which
W> is
W> A5 (the second A above middle C). Please see
W> for a fix for the bug I found here.

Gleb Smirnoff