Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a5b4c943cd4f21fc0db7accbc1341c0f > files > 6

pymad-0.6-2mdv2010.0.i586.rpm

pymad - a Python wrapper for the MPEG Audio Decoder library

MAD is available at http://www.mars.org/home/rob/proj/mpeg/

Access this module via "import mad" or "from mad import *".  To decode
an mp3 stream, you'll want to create a MadFile object and read data from
that.  You can then write the data to a sound device.  See the example
program in test/ for a simple mp3 player that uses libao for the sound
device.

This wrapper isn't as low level as the C MAD API is, for example, you don't
have to concern yourself with fixed point conversion -- this was done to
make pymad easy to use.
 
To build, you need the distutils package, availible from
http://www.python.org/sigs/distutils-sig/download.html (it comes with
Python 2.0). Run "python setup.py build" to build and then as root run
"python setup.py install".  You may need to run the config_unix.py
script, passing it a --prefix value if you've installed your mad stuff
someplace weird.  Alternately, you can just create a file called
"Setup" and put in values for mad_include_dir, mad_lib_dir, and
mad_libs.  The file format for Setup is:

key = value

with one pair per line.