Compile Lame

This document is for compiling lame on Mac OS X Snow Leopard. The procedure is similar on any other UNIX type system. Installing lame on a Linux system (Ubuntu, Debian) is easy; open a terminal and just type "sudo apt-get install lame". But if you have problems with glitches as I have had, do read on. For Windows I recommend googling for pre-compiled binaries.

Step 1

Earlier I have had problems with glitches in mp3 files converted from aif files. The solution for me was to use libsndfile as a part of the lame compilation. I you have this problem on an Ubuntu or any other Linux system I highly recommend compiling lame yourself.

Download and compile libsndfile first.

curl -O ''

The latest version when I wrote this was libsndfile-1.0.25.tar.gz


tar xzvf libsndfile-1.0.25.tar.gz
cd libsndfile-1.0.25


make check
sudo make install

sndfile gives some other fun functions, test this:

sndfile-convert --help

Usage : sndfile-convert [options] [encoding] <input file> <output file>

where [option] may be:

-override-sample-rate=X : force sample rate of input to X

where [encoding] may be one of the following:

-pcms8 : force the output to signed 8 bit pcm
-pcmu8 : force the output to unsigned 8 bit pcm
-pcm16 : force the output to 16 bit pcm
-pcm24 : force the output to 24 bit pcm
-pcm32 : force the output to 32 bit pcm
-float32 : force the output to 32 bit floating point
-ulaw : force the output ULAW
-alaw : force the output ALAW
-ima-adpcm : force the output to IMA ADPCM (WAV only)
-ms-adpcm : force the output to MS ADPCM (WAV only)
-gsm610 : force the GSM6.10 (WAV only)
-dwvw12 : force the output to 12 bit DWVW (AIFF only)
-dwvw16 : force the output to 16 bit DWVW (AIFF only)
-dwvw24 : force the output to 24 bit DWVW (AIFF only)
-vorbis : force the output to Vorbis (OGG only)

The format of the output file is determined by the file extension of the
output file name. The following extensions are currently understood:

aif : AIFF (Apple/SGI)
wav : WAV (Microsoft)
au : AU (Sun/NeXT)
caf : CAF (Apple Core Audio File)
flac : ????
snd : AU (Sun/NeXT)
svx : IFF (Amiga IFF/SVX8/SV16)
paf : PAF (Ensoniq PARIS)
fap : PAF (Ensoniq PARIS)
gsm : RAW (header-less)
nist : WAV (NIST Sphere)
htk : HTK (HMM Tool Kit)
ircam : SF (Berkeley/IRCAM/CARL)
sf : SF (Berkeley/IRCAM/CARL)
voc : VOC (Creative Labs)
w64 : W64 (SoundFoundry WAVE 64)
raw : RAW (header-less)
mat4 : MAT4 (GNU Octave 2.0 / Matlab 4.2)
mat5 : MAT5 (GNU Octave 2.1 / Matlab 5.0)
mat : MAT4 (GNU Octave 2.0 / Matlab 4.2)
pvf : PVF (Portable Voice Format)
sds : SDS (Midi Sample Dump Standard)
sd2 : SD2 (Sound Designer II)
vox : RAW (header-less)
xi : XI (FastTracker 2)
wve : WVE (Psion Series 3)
oga : ????
mpc : MPC (Akai MPC 2k)
rf64 : RF64 (RIFF 64)

Step 2

Get Lame

(In this example I downloaded lame-3.99.tar.gz)

Select source, download and unpack. (If you are following this step by step you are in the libsndfile directory. Go one level up before downloading "cd ../"):

cd ../
curl -O ''
tar xzvf lame-3.99.tar.gz
cd lame-3.99
./configure --enable-debug --enable-expopt --with-fileio=sndfile VAR=SNDFILE_LIBS=/usr/local/
sudo make install

Step 3

Hopefully you now have a functioning 64bit LAME version 3.99. Check if it's working with this simple command:

(and the answer will be..)
LAME 64bits version 3.99 (

usage: lame [options] <infile> [outfile]

<infile> and/or <outfile> can be "-", which means stdin/stdout.

"lame --help" for general usage information
"lame --preset help" for information on suggested predefined settings
"lame --longhelp"
or "lame -?" for a complete options list

Try to compress an AIF file and listen for glitches. Hopefully there will be none. The problems I had where usually in the beginning of the sound file.

lame testfile.aif testfile.mp3

Good luck!

Copyright © 2024 Hans E Andersson. All rights reserved.