Trouble with sox and MAD

I think I may be missing something simple here. I wrote a script to take multiple mp3 files and convert them to wav using sox. This script worked perfectly the last time I used it a couple months ago. Today, I found myself needing it again, but now sox will not run. Sox tells me that it cannot find the MAD decoder. I have both libmad and libmad0 installed. I used Yast to remove sox and tried to install sox from the source code. After ./configure, sox’s build options summary says there will be no support for mad, despite the fact that I know it’s installed.

I tried to downgrade to an older version of mad, but that didn’t make any difference. What the heck am I missing?

–chriscrutch

$ file test.mp3 
test.mp3: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo
$ sox -t mp3 test.mp3 test.wav
$ file test.wav 
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

Works for me™ with


rpm -qa sox "libmad*"

libmad0-0.15.1b-1.pm.3.1
sox-14.3.0-99.pm.99.4

My results:

$ file test.mp3
test.mp3: Audio file with ID3 version 2.3, MP3 encoding
$ sox -t mp3 test.mp3 test.wav
sox FAIL mp3: could not find MAD decoder library (libmad)
sox FAIL formats: can't open input file `test.mp3':

And:

rpm -qa sox "libmad*"

libmad0-0.15.1b-10.1
sox-14.3.0-99.pm.99.4
libmad0-32bit-0.15.1b-1.pm.3.1
libmad-0.15.1b-16.1

–chriscrutch

Well, then you know what to remove and replace.

Changes made, still results in failure:

$ sox -t mp3 test.mp3 test.wav
sox FAIL mp3: could not find MAD decoder library (libmad)
sox FAIL formats: can't open input file `test.mp3':

And:


$ rpm -qa sox "libmad*"
sox-14.3.0-99.pm.99.4
libmad0-0.15.1b-1.pm.3.1

cat /etc/SuSE-release

file $(which sox)

rpm -qa --queryformat '%{name}-%{version}-%{arch}
' "*sox*" "libmad*"

su - -c "zypper se -si |grep -v pattern |grep i586"

Suse version: x86_64.

Sox version: sox-14.3.0-x86_64

Libmad version: libmad0-0.15.1b-x86_64

586 packages installed: flash-player, libflashsupport, master-boot-code, w32codec-all, wine. None of those packages have x86-64 versions available to install according to Yast and my subscribed repos.

–chriscrutch

Did you build anything else from source?

whereis libmad.so.0 libmad.so

You also missed out the output of the file-command.

Sorry about the other output.


$ file $(which sox)
/usr/bin/sox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped

I have installed lots of things from source over the course of the last three years (when I first started running Suse), I don’t recall whether any of them were audio-related. I also know that the only thing I’ve installed from source since the last time I knew that sox worked was not audio-related and has since been removed.

$ whereis libmad.so.0 libmad.so
libmad.so: /usr/lib64/libmad.so.0
libmad:

–chriscrutch

Now that’s interesting:


whereis libmad.so.0 libmad.so
libmad.so: /usr/lib64/libmad.so /usr/lib64/libmad.so.0
libmad: /usr/lib64/libmad.so

See the difference?

I presume sox searches for libmad.so (instead of libmad.so.0) and does not find it.

But here comes the real fun:


ls -l /usr/lib64/libmad.so
lrwxrwxrwx 1 root root 11 12. Jan 01:54 /usr/lib64/libmad.so -> libmad.so.0

rpm -qf /usr/lib64/libmad.so
file /usr/lib64/libmad.so is not owned by any package

So this symlink must have been set by myself some time ago (and I forgot about it) or it might be some “leftover” from an older version.

However, some more research shows, that this file has been moved to the package “libmad-devel”, so try installing that one and see what that does to your problem.

After installing libmad-devel:

$ whereis libmad.so.0 libmad.so
libmad.so: /usr/lib64/libmad.so.0 /usr/lib64/libmad.so
libmad: /usr/lib64/libmad.a /usr/lib64/libmad.so

And now:

$ sox -t mp3 test.mp3 test.wav
$ file test.wav
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 44100 Hz

Beautiful. Thanks for the help.

–chriscrutch