Beep on WIndows 11

Chris Angelico rosuav at gmail.com
Sun Nov 12 12:21:19 EST 2023


On Mon, 13 Nov 2023 at 04:13, MRAB via Python-list
<python-list at python.org> wrote:
> In the old days, with a BBC micro, that was simple. It had 3 tone
> channels and 1 white noise channel, with control over frequency,
> duration and volume, beeps on different channels could be synchronised
> to start at the same time, there was a sound queue so that the SOUND
> command returned immediately, and there was an ENVELOPE command for
> controlling the attack, decay, sustain and release. All this on an 8-bit
> machine!
>
> My current PC is way more powerful. 64-bit processor, GBs of RAM, etc.
> Python offers winsound.Beep. 1 tone, no volume control, and it blocks
> while beeping.

I learned to make a computer beep using the programmable timer chip
(8254?). Send it signals on the I/O port saying "timer chip, speaker
signal, counter = N" (where N is the fundamental clock divided by the
frequency I wanted), and then "speaker, respond to timer chip". Then
you wait the right length of time, then send "speaker, stop responding
to timer chip".

Of course, I had a bug in the "wait the right length of time" part,
and my program stopped running.

My family was not amused.

ChrisA


More information about the Python-list mailing list