Using SOX on macOS

Chris Gardiner-Bill
5 min readFeb 15, 2022

--

Apple’s GarageBand is a terrific app for recording podcasts and audiobooks on a Mac. It’s free, easy to use, very stable and leverages a lot of the underlying technologies in Apple’s premium digital audio workstation, Logic. You can even hack it to do punch and roll editing with a little keyboard customisation.

However, Apple makes GarageBand for musicians rather than narrators and podcasters. As such it lacks two features many narrators use to produce podcasts and audiobooks. Firstly, it exports in stereo only — spoken word is best delivered in mono (ACX strongly recommends you do so). Secondly, GarageBand lacks Audacity’s ACX check plugin, meaning there’s no way to tell if a recording meets ACX’s audio submission requirements until you submit your audiobook.

To overcome these limitations, I use an open-source utility called SOX. SOX is a command-line app more commonly found on Linux, but you can install it easily on a Mac using Homebrew, an open-source package manager for macOS.

If you’ve never used the command line before, don’t be daunted — it’s not half as scary as it sounds. To find the Terminal on macOS, in Finder go to Applications/Utilities and open Terminal.

Terminal location on macOS
Terminal location on macOS

The Terminal looks something like this. If you’ve never used it before, the default look might be black text on a white screen. I’ve changed mine to a colour scheme that’s easier on the eye.

macOS Terminal app
macOS Terminal app

Install Homebrew

First, let us install Homebrew by typing or pasting the following command into the Terminal and pressing Return.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

This command fetches the homebrew installation script from the internet and automatically begins the installation process. It might take a few minutes, and you’ll see a lot of stuff flyby on screen. The Terminal might prompt you to enter your Mac’s password since homebrew makes changes to the UNIX underpinnings of macOS — don’t worry, these are perfectly safe.

Install SOX

With brew installed we can now install SOX itself. In your Terminal, type or paste the following command and press Return.

brew install sox

Installation might take several minutes as the command downloads and installs SOX to your computer. Once done, you can check the installation works by typing either of the following commands:

which sox
Sox installation location
Sox installation location

or

sox --version

Using SOX

Once installed, we can begin using Sox to manipulate the audio files we’ve exported from GarageBand. I’ll use one of my podcast episodes as an example, and I’ll be working with an uncompressed WAV file.

Exporting to disk from Garageband
Exporting to disk from Garageband

The export gave me a 44.1 kHz, 16-bit stereo wav file weighing in at 156.3 MB for the 14:46 minute episode.

Creating a mono file couldn’t be easier. In the Terminal type the following command.

sox input.wav output.L.wav remix 1

The command is straightforward. input.wav in my example is the file I want to use. output.l.wav is the filename we give to the newly created mono file. The remix parameter tells sox we want to bump our channels, with 1 indicating we only want 1 channel aka mono.

Note you’ll have to change input.wav and output.l.wav to the name and location of your file on the file system. As a tip, you can drag a file from Finder to the terminal to display its location.

Here’s mine as an example. Note the first line at the top of screenshot where I use the cd command to change to the file’s parent directory. To save time, type CD and then drag the parent directory from Finder to the Terminal window and press Return.

Using sox to remix to mono
Using sox to remix to mono

I now have a remix file called ep6.L.wav in the same directory, weighing in at 78.1 MB — halved because we only have one channel of audio.

Now I’ll use SOX to analyse the file to see if it meets ACX’s requirements. Chiefly, I need to know if the file measures between -23dB and -18db RMS, has a -3dB peak value and a maximum noise floor of -60dB.

Note that since this is a podcast episode, I didn’t master my file to conform to these values, so I’m expecting it to fail on ACX’s metrics.

To analyse the file, I type the following command:

sox ep6.L.wav -n stats

The output is as follows, and I’ve highlighted the stats we need in the red box.

sox showing file analysis
sox showing file analysis

As expected, I flunked in a couple of metrics because I didn’t master or normalise this podcast episode with ACX in mind.

The Pk lev dB measures our maximum peak level. My file measures -11.48 dB, which fails. This needs to be -3.0 dB.

The RMS lev dB measures our average noise level. My file measures -36.42dB, which is too quiet for ACX. This needs to be between -23dB and -18dB.

Finally, the RMS Tr dB measures our noise floor. My files measures -96.57dB, which beats the -60dB ACX requires by a healthy margin. I could comfortable raise my levels to meet the metrics I failed without raising my noise floor too high, but meh it was a podcast, and I didn’t care enough at the time.

Concluding thoughts

SOX is a terrific utility that should be in every podcaster or audiobook narrator’s toolkit. It’s particularly useful when working with Garageband, which has a couple of limitations on what’s an otherwise terrific, and free, digital audio workstation.

The example I show above barely scratch the surface of what sox is capable of doing. It’s an audio Swiss Army Knife, with the ability to convert between formats, trim audio, even apply effects, and much more than I need.

Cover Photo by Ben Koorengevel on Unsplash.

--

--

Chris Gardiner-Bill

Technical writer, blogger, and author. Lives in Melbourne, Australia with my wife and three kids. Works in tech.