[Tutor] beep

Tim Peters tim.one@home.com
Sat, 27 Jan 2001 03:31:57 -0500


[clickron@webtv.net]
> I have windows 98 and when I try to use ,
> inport winsound
> winsound.Beep(300,60)
> or any other frequencies and durations, all I can get is the windows
> ding.

Yes, I'm afraid that's right.  This was discussed on comp.lang.python just
this week, where it surprised the heck out of winsound's author.  It turns
out the Microsoft function Python calls ignores the frequency and duration
arguments under Windows 95 and 98 (I *guess* also ME), and this is
documented in Microsoft's docs.  You have to be running under Windows NT or
2000 for .Beep() to work as advertised (which the Python docs for version
2.1 will explain).

> I'm brand spankin' new at this and was wondering if there was any way to
> change the settings on windows or another way to get sound of different
> frequencies and duration.

Well, the sound .Beep() plays under Win9x can be set via changing

    Start -> Settings -> Control Panel -> Sounds -> Windows ->
    Default sound

but that's all the control you can get.  Microsoft doesn't appear to offer
any function under Win9x that does the same thing as .Beep() does under Win
NT/2K.  So it would require synthesizing wave data yourself, and using
winsound.PlaySound() to play it.  Unfortunately, that's A Project; wave data
is complicated:

    http://ccrma-www.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/

I don't know of any simpler alternative at the moment.  Sorry!