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

Joel Goldstick joel.goldstick at gmail.com
Sun Aug 15 03:19:33 EDT 2021


On Sun, Aug 15, 2021 at 1:03 AM Chris Angelico <rosuav at gmail.com> wrote:
>
> 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
> --
> https://mail.python.org/mailman/listinfo/python-list

This thread got me curious, and I found this article.  The code is
very similar to the pyaudio version a few responses back.
https://thehackerdiary.wordpress.com/2017/06/09/it-is-ridiculously-easy-to-generate-any-audio-signal-using-python/

except it doesn't need pyaudio

I run Ubuntu 20.04, and I had problems getting pyaudio on my machine.

-- 
Joel Goldstick


More information about the Python-list mailing list