< back to notes

SoX notes

SoX (Sound eXchange) is a versatile command-line tool for manipulating audio.

It is capable of taking input from microphones, files, and standard input, and sending output to speakers, files, and standard output.

All functionality can be achieved using the sox command, but the play and rec commands are provided for added convenience.

Basic usage

The sox command takes some audio input, manipulates it, and outputs it (usually to a file). It can work with familiar formats such as WAV, FLAC, OGG. Converting WAV to MP3:
sox oldfile.wav newfile.mp3
In some cases it is necessary to specify the file format with the -t/--type argument, e.g.
sox -t wav oldfile.wav -t flac newfile.mp3
will convert to the FLAC format even though the file extension says MP3. A full list of file types can be found in "man 7 soxformat".

It can also work with uncompressed, headerless "raw" formats, which can be described using the following arguments:

If you specify a raw audio format, you can treat ANY file as if it's audio! For example, here's how to play a PDF:
sox -t raw -c 1 -e unsigned-integer -b 8 -r 8000 book.pdf -d

Special files

To use the default input or output device, replace the file name & format with -d. TODO sometimes this plays funny with the number of channels...

To use standard input or standard output, replace the file name with -. You will need to provide a filetype!

Quirks

TODO see "Stopping SoX" in the man 1 sox manual page. also TODO figure out the double-recording mystery; I think it's related.

The Green Goose trans Hosted on Neocities Edited with Vim - Improved & Free - I love my editor Enter the Void Anti-fascism The Mod Archive