Skip to content

Installing SoX on Mac OSX with optional mp3, flac, vorbis, ao, amr, opus support

Reza Hashemi edited this page Jul 11, 2017 · 1 revision

Use brew package manager to install SoX

~$ brew info sox
sox: stable 14.4.2 (bottled)
SOund eXchange: universal sound sample translator
https://sox.sourceforge.io/
/usr/local/Cellar/sox/14.4.2 (23 files, 1.9MB) *
Built from source on 2017-07-11 at 15:58:16 with: —with-flac —with-lame —with-libao —with-libsndfile —with-libvorbis —with-opencore-amr —with-opusfile
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/sox.rb
==> Dependencies
Build: pkg-config ✔
Required: libpng ✔, mad ✔
Optional: opencore-amr ✔, opusfile ✔, libvorbis ✔, flac ✔, libsndfile ✔, libao ✔, lame ✔
==> Options
—with-flac
Build with flac support
—with-lame
Build with lame support
—with-libao
Build with libao support
—with-libsndfile
Build with libsndfile support
—with-libvorbis
Build with libvorbis support
—with-opencore-amr
Build with opencore-amr support
—with-opusfile
Build with opusfile support

~$ brew install sox —with-flac —with-lame —with-libao —with-libsndfile —with-libvorbis —with-opencore-amr —with-opusfile
Updating Homebrew…
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
buku git-lfs jenkins linkerd mypy offlineimap screen
fluent-bit heroku jsdoc3 lynis nodenv riemann vim

==> Installing dependencies for sox: opencore-amr, opus, libogg, opusfile, libvorbis, flac, libsndfile, libao
==> Installing sox dependency: opencore-amr
==> Downloading https://homebrew.bintray.com/bottles/opencore-amr-0.1.5.el_capitan.bottle.tar.gz

  1. 100.0%
    ==> Pouring opencore-amr-0.1.5.el_capitan.bottle.tar.gz
    ==> Using the sandbox
    🍺 /usr/local/Cellar/opencore-amr/0.1.5: 17 files, 650.2KB
    ==> Installing sox dependency: opus
    ==> Downloading https://homebrew.bintray.com/bottles/opus-1.2.1.el_capitan.bottle.tar.gz
  2. 100.0%
    ==> Pouring opus-1.2.1.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/opus/1.2.1: 16 files, 877.3KB
    ==> Installing sox dependency: libogg
    ==> Downloading https://homebrew.bintray.com/bottles/libogg-1.3.2.el_capitan.bottle.tar.gz
  3. 100.0%
    ==> Pouring libogg-1.3.2.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/libogg/1.3.2: 96 files, 457.5KB
    ==> Installing sox dependency: opusfile
    ==> Downloading https://homebrew.bintray.com/bottles/opusfile-0.8.el_capitan.bottle.tar.gz
  4. 100.0%
    ==> Pouring opusfile-0.8.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/opusfile/0.8: 16 files, 291.7KB
    ==> Installing sox dependency: libvorbis
    ==> Downloading https://homebrew.bintray.com/bottles/libvorbis-1.3.5_1.el_capitan.bottle.tar.gz
  5. 100.0%
    ==> Pouring libvorbis-1.3.5_1.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/libvorbis/1.3.5_1: 159 files, 2.3MB
    ==> Installing sox dependency: flac
    ==> Downloading https://homebrew.bintray.com/bottles/flac-1.3.2.el_capitan.bottle.tar.gz
  6. 100.0%
    ==> Pouring flac-1.3.2.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/flac/1.3.2: 53 files, 1.8MB
    ==> Installing sox dependency: libsndfile
    ==> Downloading https://homebrew.bintray.com/bottles/libsndfile-1.0.28.el_capitan.bottle.tar.gz
  7. 100.0%
    ==> Pouring libsndfile-1.0.28.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/libsndfile/1.0.28: 48 files, 1.8MB
    ==> Installing sox dependency: libao
    ==> Downloading https://homebrew.bintray.com/bottles/libao-1.2.2.el_capitan.bottle.tar.gz
  8. 100.0%
    ==> Pouring libao-1.2.2.el_capitan.bottle.tar.gz
    🍺 /usr/local/Cellar/libao/1.2.2: 55 files, 239.6KB
    ==> Installing sox —with-opencore-amr —with-opusfile —with-libvorbis —with-flac —with-libsndfile —with-l
    ==> Downloading https://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.gz
    ==> Downloading from https://nchc.dl.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.gz
  9. 100.0%
    ==> ./configure —prefix=/usr/local/Cellar/sox/14.4.2
    ==> make install
    🍺 /usr/local/Cellar/sox/14.4.2: 23 files, 1.9MB, built in 3 minutes 30 seconds

~$ sox
sox: SoX v

sox FAIL sox: Not enough input filenames specified

Usage summary: [gopts] [ [fopts] infile]… [fopts] outfile [effect [effopt] ]…

SPECIAL FILENAMES (infile, outfile):
- Pipe/redirect input/output (stdin/stdout); may need -t
-d, —default-device Use the default audio device (where available)
-n, —null Use the `null’ file handler; e.g. with synth effect
-p, —sox-pipe Alias for `-t sox -’

SPECIAL FILENAMES (infile only):
“|program [options] …” Pipe input from external program (where supported)
http://server/file Use the given URL as input file (where supported)

GLOBAL OPTIONS (gopts) (can be specified at any point before the first effect):
—buffer BYTES Set the size of all processing buffers (default 8192)
—clobber Don’t prompt to overwrite output file (default)
—combine concatenate Concatenate all input files (default for sox, rec)
—combine sequence Sequence all input files (default for play)
-D, —no-dither Don’t dither automatically
—dft-min NUM Minimum size (log2) for DFT processing (default 10)
—effects-file FILENAME File containing effects and options
-G, —guard Use temporary files to guard against clipping
-h, —help Display version number and usage information
—help-effect NAME Show usage of effect NAME, or NAME=all for all
—help-format NAME Show info on format NAME, or NAME=all for all
—i, —info Behave as soxi(1)
—input-buffer BYTES Override the input buffer size (default: as —buffer)
—no-clobber Prompt to overwrite output file
-m, —combine mix Mix multiple input files (instead of concatenating)
—combine mix-power Mix to equal power (instead of concatenating)
-M, —combine merge Merge multiple input files (instead of concatenating)
—magic Use `magic’ file-type detection
—norm Guard (see —guard) & normalise
—play-rate-arg ARG Default `rate’ argument for auto-resample with `play’
—plot gnuplot|octave Generate script to plot response of filter effect
-q, —no-show-progress Run in quiet mode; opposite of -S
—replay-gain track|album|off Default: off (sox, rec), track (play)
-R Use default random numbers (same on each run of SoX)
-S, —show-progress Display progress while processing audio data
—single-threaded Disable parallel effects channels processing
—temp DIRECTORY Specify the directory to use for temporary files
-T, —combine multiply Multiply samples of corresponding channels from all
input files (instead of concatenating)
—version Display version number of SoX and exit
-V[LEVEL] Increment or set verbosity level (default 2); levels:
1: failure messages
2: warnings
3: details of processing
4-6: increasing levels of debug messages
FORMAT OPTIONS (fopts):
Input file format options need only be supplied for files that are headerless.
Output files will have the same format as the input file where possible and not
overridden by any of various means including providing output format options.

v|-volume FACTOR Input file volume adjustment factor (real number)
-ignore-length Ignore input file length given in header; read to EOF
-t|
-type FILETYPE File type of audio
e|-encoding ENCODING Set encoding (ENCODING may be one of signed-integer,
unsigned-integer, floating-point, mu-law, a-law,
ima-adpcm, ms-adpcm, gsm-full-rate)
b|-bits BITS Encoded sample size in bits
N|-reverse-nibbles Encoded nibble-order
X|-reverse-bits Encoded bit-order
-endian little|big|swap Encoded byte-order; swap means opposite to default
-L/-B/-x Short options for the above
-c|
-channels CHANNELS Number of channels of audio data; e.g. 2 = stereo
r|-rate RATE Sample rate of audio
C|-compression FACTOR Compression factor for output format
—add-comment TEXT Append output file comment
—comment TEXT Specify comment text for the output file
—comment-file FILENAME File containing comment text for the output file
—no-glob Don’t `glob’ wildcard match the following filename

AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb amr-nb amr-wb anb au avr awb 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 mp2 mp3 nist ogg opus paf prc pvf raw s1 s16 s2 s24 s3 s32 s4 s8 sb sd2 sds sf sl sln 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 wve xa xi
PLAYLIST FORMATS: m3u pls
AUDIO DEVICE DRIVERS: ao coreaudio

EFFECTS: allpass band bandpass bandreject bass bend biquad chorus channels compand contrast dcshift deemph delay dither divide+ downsample earwax echo echos equalizer fade fir firfit+ flanger gain highpass hilbert input# ladspa loudness lowpass mcompand noiseprof noisered norm oops output# overdrive pad phaser pitch rate remix repeat reverb reverse riaa silence sinc spectrogram speed splice stat stats stretch swap synth tempo treble tremolo trim upsample vad vol

  • Deprecated effect + Experimental effect # LibSoX-only effect
    EFFECT OPTIONS (effopts): effect dependent; see —help-effect

~$ soxi /Users/User/Desktop/in.mp3

Input File : ‘/Users/User/Desktop/in.mp3’
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:05:01.43 = 13293239 samples = 22607.5 CDDA sectors
File Size : 5.14M
Bit Rate : 136k
Sample Encoding: MPEG audio (layer I, II or III)

~$ sox /Users/User/Desktop/in.mp3 -C12 /Users/User/Desktop/out.mp3

~$ soxi /Users/User/Desktop/out.mp3

Input File : ‘/Users/User/Desktop/out.mp3’
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:05:01.48 = 13295312 samples = 22611.1 CDDA sectors
File Size : 1.21M
Bit Rate : 32.0k
Sample Encoding: MPEG audio (layer I, II or III)

Clone this wiki locally