36

I compiled libmad for sox. When I try to read an mp3 I get this message:

sox FAIL util: Unable to load MAD decoder library (libmad) function "mad_stream_buffer".

Did I compile the project incorrectly?

Anderson
  • 361
  • 1
  • 3
  • 4

6 Answers6

73

Steps to using SOX to create MP3s:

  1. Download latest version of SOX and install.
  2. Download libmad-0.dll and libmp3lame-0.dll. The currently only known trustworthy source is ossbuild but this requires you to download a 1.5 GB archive. The selected two files are available here and here.
  3. Add libmad-0.dll and libmp3lame-0.dll to the folder where SOX was installed to.
  4. Use the command line to convert a file to .mp3:

    sox input.wav -c 2 -C 128 output.mp3
    

Note: -c 2 makes it stereo, -C 128 specifies output as 128 kbps MP3

Vlastimil Ovčáčík
  • 2,799
  • 27
  • 29
bulltorious
  • 7,769
  • 4
  • 49
  • 78
  • I spent an hour fussing with trying to install LAME manually before I happened across this. Thank you and OSSBuild! – Mr Griever Oct 02 '15 at 17:38
  • @bulltorious, I can not download `libmad-0.dll` and `lbmp3lame-0.dll`. If I press `Download` button in Box, I get error in Firebug: `"NetworkError: 403 Forbidden - https://app.box.com/index.php?rm=box_download_shared_file&shared_name=tzn5ohyh90viedu3u90w2l2pmp2bl41t&file_id=f_69256952453"`. Thanks. – Саша Черных Nov 09 '16 at 15:36
  • 1
    As of August 2017 .DLLs are still there in 1.5 GB archive. Thanks. – Maris B. Aug 11 '17 at 12:53
  • the link for just the two files is dead. – Matt Jan 24 '18 at 22:23
  • 2
    Download mirror: [libmad-0.dll](https://archive.org/details/libmad-0.dll) and [libmp3lame-0.dll](https://archive.org/details/libmp3lame-0.dll). – Vlastimil Ovčáčík Aug 18 '18 at 18:53
  • 1
    Working like a charm – C-lio Garcia Jan 25 '19 at 11:50
  • Confirmed working on windows 10 pro, 64bit (the two "single file" links still work for me, I used the 7 zip version) – 576i Dec 19 '19 at 10:03
6

You can download SoX binaries together with libmad.dll and libmp3lame.dll from http://www.videohelp.com/software/SoX

http://www.videohelp.com/download/sox-14.4.0-libmad-libmp3lame.zip

Roman Mishin
  • 461
  • 5
  • 5
5

Compiling SOX with Lame and Libmad for Windows http://www.codeproject.com/KB/aspnet/Compiling_SOX_with_Lame.aspx

naim5am
  • 1,334
  • 3
  • 17
  • 33
4

I have put together the original SoX binary and libmad and libmp3lame from http://code.google.com/p/ossbuild/source/browse/trunk/Shared/Build/Windows/Win32/bin/

SoX binary for Win32 together with libmad and libmp3lame

4

I have put together the original SoX binary and libmad and libmp3lame from http://code.google.com/p/ossbuild/source/browse/trunk/Shared/Build/Windows/Win32/bin/

SoX binary for Win32 together with libmad and libmp3lame

Thanks that was easy. Thanks for sharing this easy solution.

Nikhil
  • 16,194
  • 20
  • 64
  • 81
Lindylex
  • 41
  • 1
  • 1
    Here is the updated URL http://ossbuild.googlecode.com/svn/trunk/Shared/Build/Windows/Win32/bin/ – AzizSM Dec 12 '12 at 08:28
0

for compiling from source:

since the the tutorial http://www.codeproject.com/KB/aspnet/Compiling_SOX_with_Lame.aspx is rather dated (and did not work for me with more recent VisualStudio versions):
the SOX project contains ready-to-use Visual Studio projects for compiling SOX and its dependencies/libraries on Windows (e.g. using a Visual Studio Community Edition).

The SOX source code repository at SourceForge contains a directory msvc10 (and also msvc9) for compiling SOX and its dependencies with VisualStudio. Detailed instructions for that are in the Readme.txt.

So, for example, for only compiling libmad.dll:

  • clone SOX repository, e.g. to directory sox-code/
git clone https://git.code.sf.net/p/sox/code sox-code
sox-code/
libmad/
  • open the VisualStudio project file (*.sln) in directory sox-code/msvc10 (if needed, change build configuration form Debug to Release)
  • in the Solution Explorer window open context-menu for sub-project LibMad and select Build (or in older VS versions Project OnlyBuild Only LibMad)
  • afterwards the compiled DLL is in sox-code/msvc10/Release (or Debug depending on the selected configuration)

tested with VisualStudio 2010 and Visual Studio 2017 CE

russa
  • 399
  • 3
  • 7