How to play a .wav sound?
James T. Dennis
jadestar at idiom.com
Tue Jun 11 11:07:38 CEST 2002
Erlend J. Leiknes <nookieNO_SP_AM at online.no> wrote:
> Think this should work... not tested.
I doesn't. I doesn't in principle (cat foo.wav > /dev/dsp doesn't work
for me) and the code is wrong in at least one spot:
> sdata = f.read(1024)
> while sdata:
that would only copy 1K of data
> "Bruno Bellamy" <bellamy at neverland.net> wrote in message
> news:ad8jo7$ohl$1 at wanadoo.fr...
>> I guess the question has probably been asked many times, sorry for
>> But I searched here and there, and I couldn't find how to do that, simply
>> play a .wav sound from a python program using Tkinter.
>> Moreover, I need to do that in a program that would run similarly under
>> Linux and Windows.
>> I saw there's a python module called wave, but it seems it can only read
>> .wav files. I coulnd't find a way to actually play the sound. Maybe it's
>> hidden somewhere?
>> If anybody can help me, that would be cool. :)
I was stumped for a little while last night as well. Unfortunately
I don't have a simple working example, yet; but it looks like
pysolsoundserver.so and the PySol (Python Solitaire) sources might
be a good start. Apparently PyGame also has some sophisticated
sound handling. There doesn't seem to be a way to do it (easily)
with the standard libraries, though.
More information about the Python-list