Winsound doesn't play whole sound?

D

Dieter Vanderelst

Hello,

I'm having a problem with playing WAV files using Winsound.

If I use winsound to play a certain WAV files only the first few seconds
of the file get played. I think this comes because these files contain
some parts of silence. There winsound seems the stop playing the files
(windows media player plays the sounds correctly).

Does anybody have an idea about how I could fix this problem? I have
considered installing extra modules like PyMedia. But this would limit
the portability of my script (I would have to install PyMedia on all the
Pc's I want to use my script on).

Many Thanks,
Dieter

Just as a reference, the code I use:
winsound.PlaySound("My_wav.wav", winsound.SND_FILENAME)
 
G

Graham Fawcett

Dieter said:
Hello,

I'm having a problem with playing WAV files using Winsound.

If I use winsound to play a certain WAV files only the first few seconds
of the file get played. I think this comes because these files contain
some parts of silence. There winsound seems the stop playing the files
(windows media player plays the sounds correctly). [snip]
Just as a reference, the code I use:
winsound.PlaySound("My_wav.wav", winsound.SND_FILENAME)

This is totally a guess, but add the following to the end of your test
script:

import time
time.sleep(10)

Did the file play for ten seconds longer? I don't know anything about
winsound, but I'm guessing that the PlaySound call is non-blocking, and
your playback stops because your process is quitting before the sound
has played.

Graham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top