problems converting MP3s to WAVs
Klaus-Peter Schrage
kpschrage
Sat May 28 07:43:09 PDT 2005
Net Llama! wrote:
> On Fri, 27 May 2005, Klaus-Peter Schrage wrote:
>
>
>>Net Llama! wrote:
>>
>>>On Fri, 27 May 2005, Klaus-Peter Schrage wrote:
>>>
>>>
>>>>Sorry, Lonnni, there seems to be consistency in the way the line from
>>>>mp3 to audio cd works:
>>>>cdrecord needs an input which is 16 bit, stereo, 44100 Hz, uncompressed
>>>>- usually a wav file. If it isn't, you have to make it like that. So, if
>>>>your mp3 is already 44100 Hz, you're nearly done with a simple mpg321
>>>>command. Otherwise, use a tool like sox or sndfile-resample (in the
>>>>libsamplerate package) to fix the wav.
>>>>Klaus
>>>
>>>
>>>That seems to be my problem. All of the MP3s are 32bit, instead of 16. I
>>>just scanned through the sox man page and didn't see anything obvious on
>>>how to convert from 32 to 16 bits. grrr.
>>
>>Can you put a sample mp3 somewhere so that I may have a look at it
>>(can't promise anything, I'm not a sound expert)?
>>Klaus
>
>
> Sure, try this one:
> http://netllama.linux-sxs.org/1.mp3
>
This sequence of commands turnes the initial file 1.mp3 (8.6 MB) into an
one track audio cd:
1) mpg321 -v -w 1_mo.wav 1.mp3
2) sox -V 1_mo.wav -r 44100 -c 2 1_fin.wav resample
3) cdrecord -v dev=/dev/hdc -pad 1_fin.wav
EXPLANATION short (a longer one might be worth a SxS ...)
1) Using the -v option in mpg321 tells you what the initial file is all
about:
Freq: 22050
mode: Single-Channel
encoding: signed 16 bit
Bitrate: 32 Kbits/s
What these figures mean:
- Frequency (aka: sample rate):
Indicates how often a sample has been taken from the sound, it describes
the horizontal resolution.
- Mode:
Of course, single-channel is otherwise called mono.
- Encoding:
Describes the fineness of each of the samples, ie the vertical
resolution, in this case (signed) ranging from about -32000 to 32000.
- Bitrate:
the overall data flow per second. Eg in CD audio, we have 16 bit, stereo
44100 Hz, resulting in a bitrate of
44100 x 16 x 2 = 1411.2 Kbits/s.
Common mp3 compression modes yield bitrates of 96, 128, 192 Kbits/s.
BTW: the filesize of the output wave file is 94.8 MB
2) 1_mo.wav still is mono and has a horizontal resolution of 22050 Hz.
The sox command lifts this up to what cdrecord expects as input format:
44100 Hz, 16 bit, stereo.
The 'resample' effect is not obligatory, but it is recommended to
enhance the rate conversion result.
The output 1_fin.wav is, not unexpected, nearly exactly four times as
big as the input (1_mo.wav).
3) The only remarkable option is -pad. It enlarges the input file to a
size which is a multiple of 2352, as data on an audio cd are stored in
chunks of 1/75 of a second:
44100/75 x 16 x 2 = 2352 Byte.
Klaus
More information about the Linux-users
mailing list