How to play a .wav sound?

David LeBlanc whisper at oz.net
Tue Jun 11 09:54:52 EDT 2002


Perhaps the "Snack" sound extension can help - it's primarily Tcl, but has a
python binding too. It is cross-platform.

http://www.speech.kth.se/snack/

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of James T. Dennis
> Sent: Tuesday, June 11, 2002 2:08
> To: python-list at python.org
> Subject: Re: How to play a .wav sound?
>
>
> 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:
> >             d.write(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
> >> bothering...
> >> 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.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list