The vanilla version of sox
on CentOS doesn't support the mp3
codec. Here's a list of what it does support.
$ sox
...
AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb au avr caf cdda cdr cvs cvsd
cvu dat dvms f32 f4 f64 f8 fap flac fssd gsm gsrt hcom htk ima ircam la lpc
lpc10 lu mat mat4 mat5 maud nist ogg paf prc pvf raw s1 s16 s2 s24 s3 s32 s4 s8
sb sd2 sds sf sl smp snd sndfile sndr sndt sou sox sph sw txw u1 u16 u2 u24 u3
u32 u4 u8 ub ul uw vms voc vorbis vox w64 wav wavpcm wv wve xa xi
PLAYLIST FORMATS: m3u pls
AUDIO DEVICE DRIVERS: alsa ao oss ossdsp pulseaudio
You can download the source RPM of sox
and recompile with libmad
and lame-devel
libraries installed to add support for this feature.
This tutorial should help, titled: INSTALLING SOX W/ MP3 SUPPORT ON CENTOS 5.X, though it's for CentOS 5.x it should still apply. There are also steps in the comments of that post for compiling sox
with mp3
support on CentOS 6.x.
Steps
From the comments.
The one-stop solution for CentOS 6.4 without mad or libid3tag (YMMV):
### as root
$ yum install -y sox lame
$ mkdir /usr/local/src/SoX
$ cd /usr/local/src/SoX
$ wget http://downloads.sourceforge.net/project/sox/sox/14.4.1/sox-14.4.1.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsox%2Ffiles%2Fsox%2F14.4.1%2F&ts=1366019279&use_mirror=freefr
$ tar -xvzf sox-14.4.1.tar.gz
$ cd sox-14.4.1/
$ ./configure
$ make -s
$ make install
$ echo “include /usr/local/lib” >> /etc/ld.so.conf
$ /sbin/ldconfig
Repo #1 - RPM Fusion
To be able to install lame
you'll need to add an additional YUM Repo to your mix. The repo that contains lame
is called RPM Fusion. At the time that I'm writing this the latest version of the RPM that will install the RPM Fusion repo is at: rpmfusion-nonfree-release-6-1.noarch. To install it:
$ sudo rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm
NOTE: You may need an RPM signing keys, specifically this one for EL6.
Repo #2 - EPEL
Installing the RPM Fusion repo requires another YUM repo called EPEL - Extra Packages for Enterprise Linux. You'll need to install this RPM as well, priror to installing RPM Fusion's RPM.
$ sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
NOTE: The version number on this repo changes from time to time so it's best to check what the lastest one is. Currently at the time of this post the latest version was 6.8. You can see these numbers in the package name above, "epel-release-6-8.noarch.rpm".
References
The effects function as a chain, so the stat
effect feeds into trim
, swap them around and it will work, e.g.:
sox audio.wav -n trim 50 5 stat
Best Answer
Yes,
sox
uncompresses and re-compresses lossy formats while processing (seeman sox
), and iterated compression will cause slight detoriation of quality.To change the gain in an mp3 file, it's not necessary to re-encode it, because the gain values are separate from the encoded data. You can use applications like
mp3gain
to change the gain values directly, without causing detoriation in audio quality.