SoX: concat audiofiles and convert to MP3

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
peter_b
Chatterbox
Posts: 383
Joined: Tue Nov 12, 2013 2:05 am

SoX: concat audiofiles and convert to MP3

Post by peter_b »

I needed to transcode >2GB WAVs to MP3s, so I couldn't just use lame, because I had to glue the WAVs together first.
My set of WAVs looked like this:
audio.wav
audio.w01
audio.w02
Unfortunately, Debian ships with a SoX version which cannot output MP3s (The package "libsox-fmt-mp3" is only for SoX being able to handle MP3 as input).

So I'm connecting SoX with Lame, using StdIn/StdOut pipes like this:

Code: Select all

sox audio.wav audio.w01 audio.w02 -r 44100 -b 16 -c 2 -t raw - | lame -s 44.1 --bitwidth 16 -r -b 192k - output.mp3
The "-" as sox-output and lame-input is the default character for the standard in/out pipe.
Important is to tell both sides (SoX and Lame) the properties of the raw audio stream. In this case it's "stereo" (=2 channels), "16 bits", "44100 Hz" sample rate.
Post Reply