SoX: How to Convert WAV to MP3

Updated

Learn how to convert a WAV file to an MP3 using SoX

SoX: How to Convert WAV to MP3

Install SoX

Before we start, make sure you have SoX installed on your computer and your WAV file ready in a folder. If you don't have it yet, you can install SoX with Homebrew:

brew install sox

Convert the WAV to MP3

First, open your terminal and navigate to the folder containing your WAV file. To convert it to an MP3, run this command:

sox input.wav output.mp3

Just swap input.wav with the name of your WAV file, and output.mp3 with the name you want for the new file. That's all it takes.

For a short clip, this finishes almost instantly, and don't worry if you don't see a success message, SoX stays quiet when everything works. To check the new file, run open output.mp3.

Set the Bitrate

Want more quality? Add the -C flag and set the bitrate in kbps:

sox input.wav -C 320 output.mp3

The 320 value gives you high quality 320 kbps audio. Use 256 or 192 instead if you'd rather have smaller files.

Fix the No Handler Error

If you ever see no handler for file extension 'mp3', your SoX build is missing MP3 support. Just install the LAME library with brew install lame and run the command again.

undefined

Your original input.wav is never modified, so you can always re-run the command with a different -C value to compare quality.