![]() |
version seven.   http://demongin.org |
How To Install Pymad on Fedora/RHEL
A short explanation for those having trouble building from source in a Fedora environment.
Thursday, 2009-11-12 | Music, Programming
| pymad is a Python module that allows Python programs to use the MPEG Audio Decoder library. pymad provides a high-level API, similar to the pyogg module, which makes reading PCM data from MPEG audio streams a piece of cake. |
| spacepants.org |
pymad is an old-ish python module used to work with MPEG files. I'm working on a project where I want to use it to determine the duration of MP3 files without actually counting frames or playing them or doing anything hard/processor-intensive. Problem is, while there's a Debian package for pymad (i.e. "python-pymad"), there's no package on Fedora and I've got to develop for both environments.
So, on my Fedora machine, I downloaded the source files and set to work.
The source package comes with a script called config_unix.py that is supposed to write the "Setup" file you need to build the module. The only problem with that is that, if you run it, you'll probably get an error like this:
[toconnell@kumiko pymad-0.6]$ ./config_unix.py _temp.c:5:17: error: mad.h: No such file or directory Checking for MAD ... test program failed Config failure
And if, like me, your first response to that message would be to install the madplay package and try again, you would end up, like me, exactly where you began: the mad.h file is not a part of the madplay package:
[toconnell@kumiko pymad-0.6]# rpm -ql madplay /usr/bin/abxtest /usr/bin/madplay /usr/bin/madtime /usr/share/doc/madplay-0.15.2b /usr/share/doc/madplay-0.15.2b/CHANGES /usr/share/doc/madplay-0.15.2b/COPYING /usr/share/doc/madplay-0.15.2b/COPYRIGHT /usr/share/doc/madplay-0.15.2b/CREDITS /usr/share/doc/madplay-0.15.2b/README /usr/share/doc/madplay-0.15.2b/TODO /usr/share/locale/en/LC_MESSAGES/madplay.mo /usr/share/locale/es/LC_MESSAGES/madplay.mo /usr/share/locale/fr/LC_MESSAGES/madplay.mo /usr/share/locale/hr/LC_MESSAGES/madplay.mo /usr/share/locale/no/LC_MESSAGES/madplay.mo /usr/share/man/man1/abxtest.1.gz /usr/share/man/man1/madplay.1.gz
So I did a little Googling, and it turns out that the package you I needed to install was the development one (obviously enough):
[root@kumiko pymad-0.6]# yum install libmad-devel
[root@kumiko pymad-0.6]# rpm -ql libmad-devel /usr/include/mad.h /usr/lib/libmad.so /usr/lib/pkgconfig/mad.pc [root@kumiko pymad-0.6]# ./config_unix.py Checking for MAD ... success Checking endianness ... success Wrote Setup file
[root@kumiko pymad-0.6]# ./setup.py install
