I was using winsound module for the first time to use it on one of my small app,and it didn't even gave me a BEEP!.

I imported winsound module first.

>>> import winsound
>>>

then

winsound.Beep(37,10)

leads to nothing!
Any kinda help is appreciated.

winsound.Beep(37,10)
Your frequency of 35 hertz is below the audible range
Your duration of 10 milliseconds is too short

Try something like ...
winsound.Beep(440, 200)

winsound.Beep(37,10)
Your frequency of 35 hertz is below the audible range
Your duration of 10 milliseconds is too short

Try something like ...
winsound.Beep(440, 200)

Still nothing Aye.Is something wrong with my audio/speaker settings or what?
should I try other modules like pygame?
Thanks for the comment by the way.

Just a note that winsound will work on the Windows OS only.

I've got Windows Xp SP2.I'm seeking for other options here.let me know if you have anything like that to share ,especially audio specific modules.

Strange, winsound.Beep() works very well on my XP machine's internal speaker. Maybe you can run this little test ...

# play a sound on a Windows Box (Python2 or 3)
# Playsound(sound, flags) accepts wave sound files and uses
# the external speaker system
# Beep(frequency, duration) uses the internal speaker of the computer

import winsound as ws
import time

# pick a wave file supplied by Windows XP or one of your own ...
soundfile = "C:/Windows/Media/chimes.wav"
ws.PlaySound(soundfile, ws.SND_FILENAME|ws.SND_ASYNC)

# wait one and a half seconds
time.sleep(1.5)

# play the system exit sound if set
ws.PlaySound("SystemExit", ws.SND_ALIAS)

time.sleep(1.5)

frequency = 800  # hertz or cps
duration = 3000  # milliseconds
ws.Beep(frequency, duration)

# help('winsound')

PyGame and wxPython also allow you to play wave sound files. Here is an example of pygame code ...

# use the pygame module to play a wave sound file
# pygame is free from: http://www.pygame.org/
# tested with Python26 and Python31

import pygame as pg

def play_sound(sound_file):
    """
    will load the whole sound into memory before playback
    """
    sound = pg.mixer.Sound(sound_file)
    clock = pg.time.Clock()
    sound.play()
    # how often to check active playback
    frame_rate = 30
    while pg.mixer.get_busy():
        clock.tick(frame_rate)


FREQ = 18000   # play with this for best sound
BITSIZE = -16  # here unsigned 16 bit
CHANNELS = 2   # 1 is mono, 2 is stereo
BUFFER = 1024  # audio buffer size, number of samples

pg.mixer.init(FREQ, BITSIZE, CHANNELS, BUFFER)

# pick a wave (.wav) sound file you have
#sound_file = "Chimes.wav"
sound_file = "DingDong.wav"

play_sound(sound_file)

Now here's a interesting story .The test code did manage to play the WAV files but not 'The Beep'.Anyway Beep is not my problem,but actually Beep is the only problem here.
Thanks man .Lot to do with Winsound..

Here's an interesting story.The code managed to play the WAV files but I didn't hear any 'BEEP'.Thanks anyway man.
Gotta be working on winsound..

Maybe you PC internal speaker is not working?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.