Converting .wav (CCITT A-Law format) to .mp3 using LAME

4

I would like to convert wav files to mp3 using the lame encoder (lame.exe). The wav files are recorded along the following specifications:

Bit Rate: 64kbps
Audio sample size: 8 bit
Channels: 1 (mono)
Audio sample rate: 8 kHz
Audio format: CCITT A-Law

If I try to convert such a wav file using lame, I get the following error message:

Unsupported data format: 0x0006

Could anyone provide me with a command line string using lame.exe that will enable me to convert these kind of wav files?

George

Posted 2009-10-28T15:06:01.453

Reputation: 169

what command line are you using currently? – Jeff Shattock – 2009-10-28T23:28:44.710

Answers

4

You want to use SoX to convert the A-law input data to a more standard PCM data for LAME to process.

sox -A -c 1 -r 8000 input.8khz-mono-alaw.wav ouput.wav

Now output.wav should contain standard PCM WAV data. Run your LAME command on this (add whatever options you like):

lame output.wav output.mp3

Or, pipe the SoX output into LAME directly:

sox -A -c 1 -r 8000 input.8khz-mono-alaw.wav - | lame - output.mp3

quack quixote

Posted 2009-10-28T15:06:01.453

Reputation: 37 382

1thank you thank you thank you. I was incorrectly using -e signed-integer instead of -e a-law (your -A argument for older version of sox). – Josh Smeaton – 2014-03-12T07:26:43.773

1And I'd like to recommend not piping sox to lame, as you may get missing header information since sox waits for the file to close before writing certain headers. – Josh Smeaton – 2014-03-12T07:27:20.777

0

download and compile libsndfile I used version 1.0.17 download the source for lame and then use this configure setting

./configure --with-fileio=sndfile

then

make && make install

now it will work.

oden

Posted 2009-10-28T15:06:01.453

Reputation: 1

0

Here's the answer that worked for me:

I converted my WAV files using the following commands:

sox file.wav file.cdr

sox -t cdr file.cdr -t wav - | lame -b 32 -m mono - file.mp3

These commands produce with my WAV files MP3 files in 32 kbit/s, 22050 Hz mono format. The parameters of the lame command are customized to produce the files similar to the files produced by the command mentioned in the former post:

sox file.wav file.mp3

On my machine the command:

sox file.wav file.mp3

converts WAV files in 23 minutes producing 130 MB of MP3 files.

and the commands:

sox file.wav file.cdr sox -t cdr file.cdr -t wav - | lame -b 32 -m mono - file.mp3

convert WAV files in 39 minutes producing 131 MB of MP3 files.

First method is faster but requires patched sox.

fiatjaf

Posted 2009-10-28T15:06:01.453

Reputation: 35