play mp3 files from python

Adam Endicott adam at sciencemedia.com
Sat Oct 25 17:58:35 EDT 2003


In article <mailman.97.1067114751.702.python-list at python.org>, 
tim.ronning at start.no says...
> Adam,
> 
> I have just done the same thing. Here's a solution for you. Pymad org. code
> 
> #!/usr/bin/env python
> import mad, ao, sys
> mf = mad.MadFile(sys.argv[1])
> dev = ao.AudioDevice('oss', rate=mf.samplerate())
> while 1:
>     buf = mf.read()
>     if buf is None:
>         break
>     dev.play(buf, len(buf))
> 
> You need to get the pymad module, libmad mp3 decoder and the ao module. Do 
> a google and you will find them all.
> 
> Best of luck
> 
> Tim Ronning

Thank you for the quick reply. I found pymad, libmad, and ao, but I can't 
get them installed. If I run 'python setup.py build' (or install) for 
either pymad or ao, I just get "No 'Setup' file. Perhaps you need to run 
the configure script.". So I run config_unix.py not expecting it to work, 
and of course it doesn't. I'm on Windows ME. The website isn't much help 
for clueless windows users like myself. I can't just put the .c and .h 
files in site-packages right? I'm sure I must need *some* python code 
somewhere.




More information about the Python-list mailing list