Date: Thu, 21 Oct 2021 22:55:00 -0600 From: Warner Losh <imp@bsdimp.com> To: Alexey Dokuchaev <danfe@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: <CANCZdfpMyOgKvnkHvH_Cwg_s9=3dxaon4PRe2kBJYTxtc6qzVg@mail.gmail.com> In-Reply-To: <YXItLjwMQ58k9kOu@FreeBSD.org> References: <202110190738.19J7cFtw067994@gitrepo.freebsd.org> <20211019112132.GC80160@zxy.spb.ru> <20211019133700.77c0ca7ac488eb99df50551b@bidouilliste.com> <20211020095206.GA77338@zxy.spb.ru> <20211020134237.17596440e1fabda5d40f6985@bidouilliste.com> <YXBNqdMe2y1bJj43@FreeBSD.org> <20211021080214.GB77338@zxy.spb.ru> <YXGdSdBWvHzHqK4J@FreeBSD.org> <99e7aecf-9ab7-8b8f-ff30-b5fce3e031c2@FreeBSD.org> <CANCZdfrPMLBSzuo1XzWroVMpzG_mLDeZxTbo3r0-_7SQz_C8%2Bg@mail.gmail.com> <YXItLjwMQ58k9kOu@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000ccd16005cee9d0b2 Content-Type: text/plain; charset="UTF-8" On Thu, Oct 21, 2021 at 9:17 PM Alexey Dokuchaev <danfe@freebsd.org> 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... > > > > https://twitter.com/bsdimp/status/1451274644439265308 > > 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 value. Now, sysbeep is only defined on x86, where this is timer_spkr_setfreq(pitch); 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, 436, 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 other factors I've not even thought of. Warner P.S. We likely should fix this bug, and also change the note to 880, which is A5 (the second A above middle C). Please see https://reviews.freebsd.org/D32594 for a fix for the bug I found here. --000000000000ccd16005cee9d0b2--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpMyOgKvnkHvH_Cwg_s9=3dxaon4PRe2kBJYTxtc6qzVg>