Regarding inability of Python Module Winsound to produce beep in decimal frequency

Chris Angelico rosuav at gmail.com
Sun Aug 15 01:01:51 EDT 2021


On Sun, Aug 15, 2021 at 1:02 PM John O'Hagan <research at johnohagan.com> wrote:
>
> > On 2021-08-13 17:17, Chris Angelico wrote:
> > > Is it really? In my experience, no human ear can distinguish 277Hz
> > > from 277.1826Hz when it's played on a one-bit PC speaker, which the
> > > Beep function will be using.
>
> Rounding to integer frequencies will produce disastrously out-of-tune
> notes in a musical context! Particularly for low notes, where a whole
> semitone is only a couple of Hz difference. Even for higher notes, when
> they're played together any inaccuracies are much more apparent.

But before you advocate that too hard, check to see the *real*
capabilities of a one-bit PC speaker. You go on to give an example
that uses PyAudio and a sine wave, not the timer chip's "beep"
functionality.

Try getting some recordings of a half dozen or so computers making a
beep at 440Hz. Then do some analysis on the recordings and see whether
they're actually within 1Hz of that.

(And that's aside from the fact that quite a number of computers will
show up completely silent, due to either not having an internal
speaker, or not letting you use it.)

ChrisA


More information about the Python-list mailing list