sox_ng/soxformat_ng.7

1156 lines
40 KiB
Groff

'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
'\" From groff-1.23 CW is undeclared by default but nroff is CW anyway
.if n .ftr CW R
.de XE
.SP
.nf
.ft CW
..
.de XX
.ft R
.SP
.fi
..
.TH SOXFORMAT_NG 7 "November 28, 2024" "SoX" "Sound eXchange_ng"
.SH NAME
soxformat_ng \- Audio file formats supported by sox_ng and libsox_ng
.SH DESCRIPTION
This manual describes the file formats and audio device types supported by SoX;
the SoX manual set starts with
.BR sox_ng (1).
.SP
Format types that SoX can determine by a filename extension
are listed with their names preceded by a dot.
Format types that are optionally built into SoX
are marked `(optional)'.
.SP
Format types that are handled by the
external library \fBsndfile\fR are marked `(with sndfile)'
and format types that can only be read using
the external program \fBffmpeg\fR are marked `(with ffmpeg)'
.SP
Formats for which SoX has internal drivers but that are also supported
by \fBsndfile\fR or \fBffmpeg\fR are marked
(also with \fB\-t\ sndfile\fR) or (also with \fB\-t\ ffmpeg\fR).
This might be
useful if you have a file that doesn't work with SoX's built-in
readers and writers.
.SP
To see if SoX has support for an optional format or device, enter
.B sox_ng \-h
and look for its name under
`AUDIO FILE FORMATS' or `AUDIO DEVICE DRIVERS'.
.SP
To know everything about a format \- whether it reads it or writes it or both
and what encodings it can write \- enter something like
.B sox_ng \-h wav
or, to see details for all formats,
.BR sox_ng \-\-help\-format\ all .
.SH FORMATS & DEVICE DRIVERS
.TP
\fB.raw\fR (also with \fB\-t\ sndfile\fR), \
\fB.f32\fR, \fB.f64\fR, \
\fB.s8\fR, \fB.s16\fR, \fB.s24\fR, \fB.s32\fR, \
\fB.u8\fR, \fB.u16\fR, \fB.u24\fR, \fB.u32\fR, \
\fB.ul\fR, \fB.al\fR, \fB.lu\fR, \fB.la\fR
Raw (headerless) audio files. For
.BR raw ,
the sample rate and the data encoding must be given using command-line
format options; for the other listed types, the sample rate defaults to
8kHz and the data encoding is defined by the given suffix.
Thus \fBf32\fR and \fBf64\fR indicate files encoded as 32
and 64-bit IEEE-754 single and double precision floating point PCM
respectively; \fBs8\fR, \fBs16\fR, \fBs24\fR and \fBs32\fR indicate 8,
16, 24 and 32-bit signed integer PCM respectively; \fBu8\fR, \fBu16\fR,
\fBu24\fR and \fBu32\fR indicate 8, 16, 24 and 32-bit unsigned integer
PCM respectively; \fBul\fR indicates `\(*m-law' (8-bit), \fBal\fR
indicates `A-law' (8-bit) and \fBlu\fR and \fBla\fR are inverse bit-order
`\(*m-law' and `A-law' respectively.
For all raw formats, the number of channels defaults to 1.
.SP
Headerless audio files on a SPARC computer are likely to be of format
\fBul\fR; on a Mac, they're likely to be \fBu8\fR but with a
sample rate of 11025 or 22050Hz.
.SP
See
.B .ima
and
.B .vox
for raw ADPCM formats and
.B .cdda
for raw CD digital audio.
.TP
\fB.f4\fR, \fB.f8\fR, \
\fB.s1\fR, \fB.s2\fR, \fB.s3\fR, \fB.s4\fR, \
\fB.u1\fR, \fB.u2\fR, \fB.u3\fR, \fB.u4\fR, \
\fB.sb\fR, \fB.sw\fR, \fB.sl\fR, \fB.ub\fR, \fB.uw\fR
Deprecated aliases for
\fB.f32\fR, \fB.f64\fR, \fB.s8\fR, \fB.s16\fR, \fB.s24\fR, \fB.s32\fR,
\fB.u8\fR, \fB.u16\fR, \fB.u24\fR, \fB.u32\fR,
\fB.s8\fR, \fB.s16\fR, \fB.s32\fR, \fB.u8\fR and \fB.u16\fR
respectively.
.TP
\fB.3gp\fR, \fB.3gpp\fR (with ffmpeg)
Third Generation Partnership Project format.
.TP
\fB.3g2\fR, \fB.3gp2\fR, \fB.3gpp2\fR (with ffmpeg)
Third Generation Partnership Project 2 format.
.TP
\fB.8svx\fR (also with \fB\-t\ sndfile\fR)
Amiga 8SVX musical instrument description format.
.TP
\fB.aa\fR (with ffmpeg)
Audible Audiobook format.
.SP
SoX can autodetect this format but, if it's coming from a pipe,
\fBffmpeg\fR fails to decode it.
.TP
\fB.aac\fR (with ffmpeg)
Advanced Audio Coding format.
.TP
\fB.ac3\fR (with ffmpeg)
Audio Codec 3 (Dolby Digital) format.
.TP
\fB.act\fR (with ffmpeg)
G729a compressed speech recorded by some Chinese-made MP3 players.
.TP
\fB.adts\fR (with ffmpeg)
Audio Data Transport Stream format.
.TP
\fB.aiff\fR, \fB.aif\fR (also with \fB\-t\ sndfile\fR or \fB\-t\ ffmpeg\fR)
AIFF files as used on old Apple Macs, Apple IIc/IIgs and SGI.
SoX's AIFF support does not include multiple audio chunks
nor the 8SVX musical instrument description format.
AIFF files are multimedia archives and
can have multiple audio and picture chunks;
you may need a separate archiver to work with them.
On MacOS X, AIFF has been superseded by CAF.
.TP
\fB.aiffc\fR, \fB.aifc\fR (also with \fB\-t\ sndfile\fR)
AIFF-C is based on AIFF but also handles compressed audio.
It can also handle little-endian uncompressed linear data
that is often referred to as
.B sowt
encoding. This encoding has become the defacto format produced by modern
Macs as well as iTunes on any platform. AIFF-C files produced
by other applications typically have the file extension .aif and
require looking at its header to detect the true format.
.BR sowt ,
.B a-law
and
.B u-law
are the only encodings that SoX can read and write natively;
for other compression types like GSM try \fB\-t\ ffmpeg\fR.
.SP
AIFF-C is defined in DAVIC 1.4 Part 9 Annex B.
This format is referred from ARIB STD-B24, which is specified for
Japanese data broadcasting. Private chunks are not supported.
.TP
\fBalsa\fR (optional)
The Advanced Linux Sound Architecture device driver supports both playing and
recording audio. ALSA is only used in Linux-based operating systems, though
these often support OSS (see below) as well. Examples:
.XE
sox_ng infile \-t alsa
sox_ng infile \-t alsa default
sox_ng infile \-t alsa plughw:0,0
sox_ng \-b 16 \-t alsa hw:1 outfile
.XX
.TP
.B .amb
Ambisonic B-Format is a specialization of
.B .wav
with between 3 and 16 channels of audio for use with an Ambisonic decoder.
See http://www.ambisonia.com/Members/mleese/file-format-for-b-format for
details. It is up to you to get the channels together in the right
order and at the correct amplitude.
.TP
\fB.amr\-nb\fR, \fB.amr\-wb\fR (both optional, also with \fB\-t\ ffmpeg\fR)
Adaptive Multi Rate Narrow and Wide Band are lossy formats for speech
used in 3rd generation mobile telephony and defined in 3GPP TS\ 26.071
and TS\ 26.171
.SP
AMR-NB audio has a fixed sampling rate of 8kHz and AMR-WB of 16kHz
and they support encoding to the following bit rates, selected by the
.B \-C
option:
.TS
center;
cfB s c cfB s
cfB l c cfB l
ce ne ce ce ne.
amr\-nb \ amr\-wb
-C kbit/s \ -C kbit/s
0 4.75 \ 0 6.6
1 5.15 \ 1 8.85
2 5.9 \ 2 12.65
3 6.7 \ 3 14.25
4 7.4 \ 4 15.85
5 7.95 \ 5 18.25
6 10.2 \ 6 19.85
7 12.2 \ 7 23.05
\ \ \ 8 23.85
.TE
.TP
\fBao\fR (optional)
Xiph.org's Audio Output device driver only works for playing audio.
It supports a wide range of devices and sound systems; see its documentation
for the full range. For the most part, SoX's use of libao cannot be
configured directly; instead, libao configuration files must be used.
.SP
The filename is used to determine which libao plugin to
use and normally, you should specify `default'. If that
doesn't give the desired behavior, you can specify the short name
for a given plugin (such as \fBpulse\fR for the PulseAudio plugin
or \fBnull\fR for testing. See http://xiph.org/ao).
Examples:
.XE
sox_ng infile \-t ao
sox_ng infile \-t ao default
sox_ng infile \-t ao pulse
.XX
.TP
\fB.ape\fR (with ffmpeg)
Monkey's Audio format.
.TP
\fB.apm\fR (with ffmpeg)
Ubisoft Rayman 2 APM format.
.TP
\fB.aptx\fR (with ffmpeg)
Audio Processing Technology for Bluetooth format.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.aptx', you will need to prefix it with `\fB-t\ ffmpeg\fR'.
.TP
\fB.argo_asf\fR (with ffmpeg)
Argonaut Games ASF format.
.TP
\fB.asf\fR (with ffmpeg)
Advanced / Active Streaming Format.
.TP
\fB.ast\fR (with ffmpeg)
AST Audio Stream format.
.TP
\fB.au\fR, \fB.snd\fR (also with \fB\-t\ sndfile\fR or \fB\-t\ ffmpeg\fR)
Sun Microsystems AU files.
There are many types of AU file;
DEC has invented its own with a different magic number
and byte order. To write a DEC file, use the
.B \-L
(little-endian) output file option.
.SP
Some \fB.au\fR files are known to have invalid AU headers; these
are probably original Sun \(*m-law 8000\ Hz files and
can be dealt with using the
.B .ul
format.
.SP
It is possible to override AU file header information
with the
.B \-r
(sampling rate)
and
.B \-c
(number of channels)
options, in which case SoX will issue a warning about the mismatch.
.TP
\fB.avi\fR (with ffmpeg)
Audio Video Interleaved format.
.TP
\fB.avr\fR (also with \fB\-t\ ffmpeg\fR or \fB\-t\ sndfile\fR)
Audio Visual Research format,
used by a number of commercial packages on the Mac.
.TP
\fB.caf\fR (with sndfile, also with \fB\-t\ ffmpeg\fR)
Apple's Core Audio File format.
.TP
\fB.cdda\fR, \fB.cda\fR, \fB.cdr\fR
`Red Book' Compact Disc Digital Audio (raw audio). CDDA has two audio
channels formatted as 16-bit big-endian signed integers at a sample
rate of 44\*d1\ kHz. The number of stereo samples in each CDDA
track is always a multiple of 588.
.SP
By default, SoX expects and produces CDDA in big-endian format.
However, the endianess of CDDA files can vary depending on the tools
and hardware used.
To produce and to read little-endian CDDA files, predece the filename
with the \fB\-L\fP option.
.TP
\fBcoreaudio\fR (optional)
The MacOS X CoreAudio device driver supports both playing and recording.
If a filename is not specified or is "default",
the default audio device is selected.
Any other name will be used to select a specific device.
.SP
Examples:
.XE
sox_ng infile \-t coreaudio
sox_ng infile \-t coreaudio "Internal Speakers"
.XX
You can also select a device by its number; to see the device numbers:
.XE
sox_ng \-V \-n \-t coreaudio nonexistent
.XX
.TP
\fB.cvsd\fR, \fB.cvs\fR
Continuously Variable Slope Delta modulation is a headerless format
used to compress speech audio for applications such as voice mail
with a fixed bit rate of 8kHz.
This format is sometimes used with bit-reversed samples; the
.B \-X
option can be used to set the bit order.
.TP
\fB.cvu\fR
Unfiltered Continuously Variable Slope Delta modulation
is an alternative handler for CVSD that is unfiltered but can
be used with any sampling rate. As it is a headerless format,
you have to specify the sampling rate with \fB\-r\fR if it is
different from 8kHz.
.XE
sox_ng infile outfile.cvu rate 28k
play \-r 28k outfile.cvu sinc \-3.4k
.XX
.TP
.B .dat
Text Data files contain a textual representation of sample data.
There is one line at the beginning that contains the sample rate
and one that contains the number of channels.
Subsequent lines contain two or more numeric data items:
the time since the beginning of the first sample and the sample value
for each channel.
.SP
Values are normalized so the maximum and minimum are 1 and \-1.
This file format can be used to create data files for external programs
such as FFT analyzers or graph routines. SoX can also convert
a file in this format back into one of the other formats.
.SP
Example containing only 2 stereo samples of silence:
.SP
.XE
; Sample Rate 8012
; Channels 2
0 0 0
0.00012481278 0 0
.XX
.TP
\fB.dfpwm\fR (with ffmpeg)
Dynamic Filter Pulse Width Modulation format 1a.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.dfpwm', you will need to prefix it with `\fB-t\ ffmpeg\fR'.
.TP
\fB.dts\fR (with ffmpeg)
Digital Theatre Systems format.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.dts', you will need to prefix it with `\fB-t\ ffmpeg\fR'.
.TP
.B .dff
Direct Stream Digital Interchange File Format (DSDIFF) is a format
defined by Philips for storing 1-bit DSD data, used in SACD mastering
and occasionally for online distribution.
SoX can write single-, double- and quad-sample rates of
64, 128 and 256 times 44100Hz (2822400, 5644800 and 11289600Hz),
known as DSD64, DSD128 and DSD256,
but not the octuple- and sexdecuple- variants (DSD512 and DSD1024).
.TP
\fB.dsf\fR, \fB.wsd\fR
DSD Stream File and Wideband Single-bit Data are formats defined by Sony
and by Sharp and Pioneer for storing 1-bit DSD data,
commonly used for online distribution of audiophile recordings,
supporting the same sample rates as \fBdff\fP.
The \fBwsd\fR variant can be read but not written.
.TP
\fB.dvms\fR, \fB.vms\fR
The Digital Voice Messaging System format is used in Germany
to compress speech audio for voice mail.
It is a self-describing variant of
.BR cvsd .
.TP
\fB.ea\fR (with ffmpeg)
Electronic Arts Multimedia format.
.TP
\fB.eac3\fR (with ffmpeg)
Enhanced AC-3 Audio.
.TP
\fB.f4v\fR (with ffmpeg)
Another name for
.BR .mov .
.TP
\fB.fap\fR (with sndfile)
See
.BR .paf .
.TP
\fBffmpeg\fR (optional)
This is a pseudo-type that uses the external program \fBffmpeg\fP
if it is installed. It can only read files, not write them,
and will extract the sound track from many video file formats.
\fBffmpeg\fR deduces the actual file type from the file's contents
with a far more advanced algorithm than that used by SoX,
which only recognizes up to two fixed byte sequences at fixed offsets.
.TP
\fB.flac\fR (optional; also with \fB\-t\ sndfile\fR or \fB\-t\ ffmpeg\fB)
Xiph.org's Free Lossless Audio Codec compressed audio.
FLAC is an open, patent-free codec designed for compressing
music. It is similar to MP3 and Ogg Vorbis but lossless,
so the audio is compressed without any loss in quality.
.SP
SoX can read native FLAC files (.flac) but can only read
Ogg FLAC files (\fB.oga\fR) if \fBffmpeg\fR is installed.
.SP
SoX can write native FLAC files according to a given or default
compression level. 8 is the default compression level and gives the
best (but slowest) compression; 0 gives the least (but fastest)
compression. The compression level is selected using the
.B \-C
option with a whole number from 0 to 8.
.TP
\fB.flv\fR (with ffmpeg)
Macromedia Flash Video format.
.TP
.B .fssd
Flexible Sound Studio Data format, a raw format that defaults to
.B .u8
at 8kHz.
.TP
.B .gsrt
Grandstream ring-tone files.
Whilst this file format can contain A-Law, \(*m-law, GSM, G.722,
G.723, G.726, G.728, or iLBC encoded audio, SoX supports reading and
writing only A-Law and \(*m-law. E.g.
.XE
sox_ng music.wav \-t gsrt ring.bin
play ring.bin
.XX
.TP
\fB.gsm\fR (optional; also with \fB\-t\ sndfile\fR or \fB\-t\ ffmpeg\fR)
GSM 06.10 Lossy Speech Compression.
A lossy format for compressing speech, used in the
Global Standard for Mobile telecommunications (GSM) and in
some voice mail applications, with a fixed sample rate of 8kHz.
.SP
Although SoX can create \fBgsm\fR files with up to sixteen channels,
it is a headerless format so input is assumed to be mono unless
it is told otherwise.
.TP
\fB.gxf\fR (with ffmpeg)
General eXchange Format.
.TP
\fB.hcom\fR (also with \fB\-t ffmpeg\fR)
Macintosh HCOM files.
These are Mac FSSD files with Huffman compression.
.TP
\fB.hip\fR
The \fB\-t\ hip\fR format forces decoding of MP3 to use \fBmp3lame\fR's
decoder based on mpglib by Michael Hipp.
.TP
\fB.htk\fR (also with \fB\-t sndfile\fR)
Single channel 16-bit PCM format used by HTK,
a toolkit for building Hidden Markov Model speech processing tools.
.TP
\fB.ircam\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
Another name for
.BR .sf .
.TP
\fB.ima\fR (also with \fB\-t sndfile\fR)
A headerless file of IMA ADPCM audio data. IMA ADPCM claims 16-bit precision
packed into only 4 bits, but in fact sounds no better than
.BR .vox .
.TP
\fB.ism\fR (with ffmpeg)
ISM streaming video format.
.TP
\fB.kvag\fR (with ffmpeg)
Simon & Schuster Interactive VAG format.
.TP
\fB.lpc\fR, \fB.lpc10\fR
LPC-10 is a compression scheme for speech developed by the United
States Department of Defense.
See https://github.com/jafingerhut/lpc10 for details. There is
no associated file format, so SoX's implementation is headerless.
.TP
\fB.m4a\fR (with ffmpeg)
MPEG-4 Audio format.
.TP
\fB.m4b\fR (with ffmpeg)
Another name for
.BR .mov .
.TP
\fB.m4v\fR, \fB.mp4\fR (with ffmpeg)
MPEG-4 Video format.
.TP
\fB.mat\fR, \fB.mat4\fR, \fB.mat5\fR (with sndfile)
Matlab 4.2/5.0 (respectively GNU Octave 2.0/2.1) format.
\fB.mat\fR is the same as \fB.mat4\fR.
.TP
.B .m3u
A playlist format, containing a list of audio files.
SoX can read but not write this file format.
See [1] for details of this format.
.TP
.B .maud
An IFF-conforming audio file type registered by
MS MacroSystem Computer GmbH and published along
with the `Toccata' sound card on the Amiga
allows 8bit linear, 16bit linear, A-Law and \(*m-law
in mono and stereo.
.TP
\fB.mj2\fR (with ffmpeg)
Another name for
.BR .mov .
.TP
\fB.mkv\fR, \fB.webm\fR (with ffmpeg)
Matroska video format.
.TP
\fB.mlp\fR (with ffmpeg)
Meridian Lossless Packing format.
.TP
\fB.mod\fR
Amiga Module format, typically created with Protracker, decoding only.
.TP
\fB.mov\fR (with ffmpeg)
MPEG-1 Systems / MPEG program stream format.
.TP
\fB.mp1\fR, \fB.m1a\fR, \fB.mp2\fR, \fB.mp3\fR (optional, also with \fB-t\ sndfile\fR, \fB\-t\ ffmpeg\fR or \fB\-t\ hip)
MP1, MP2 and MP3 compressed audio (MPEG 1 Layers 1, 2 and 3) are part of the
MPEG standards for audio and video compression whose patents have expired.
They are lossy compression formats that achieve good compression rates
with little quality loss.
.SP
.B Decoding
.SP
\fBlibmad\fR, which SoX uses to decode MPEG files, does not work on files
with a bit-rate higher than 192K but you can read those using:
.RS
.TP
\fB\-t\ sndfile\fR
which uses libmpg123, generally gives better quality results,
is better at decoding damaged or corrupt files and is twice as fast
as \fBlibmad\fR if you have an FPU;
.TP
\fB\-t\ ffmpeg\fR
which uses yet another decoder, the one in \fBlibavcodec\fR;
.TP
\fB\-t\ hip\fR
which uses LAME's internal libmpg
but the LAME program is able to decode more MPEG files
than \fB\-t\ hip\fR as it decodes the file header itself
before calling the hip decoder, whereas SoX makes the decoder
do all the work.
.RE
.\" Without .RE/.RS here, the rest of the section is hard-left indented.
.\" No idea why.
.RS
.SP
Yet more ways to decode MPEG files are input filenames like:
.XE
'|madplay -q --no-tty-control -o wav:- in.mp3'
'|mpg123 -q --no-control --wav - in.mp3'
'|lame --quiet --decode in.mp3 -'
'|ffmpeg -loglevel quiet -nostdin -i in.mp3 -'
.XX
As these piped commands cannot rewind their output pipe to fix the file length
in the header, you may prefer to add \fB--ignore-length\fR before them,
which makes SoX warn "premature EOF on input file" but keeps reading to the end.
.SP
The decoding speeds of the default libmad, \fB\-t\ hip\fP and \fB\-t\ sndfile\fP
are in proportions 1:2:2.5 with an FPU.
Without one, libmad will be the fastest instead of the slowest.
.SP
With \fBmad\fR or \fBsndfile\fR, SoX decodes MPEG files with a precision of
28 bits but it declares a precision of 16 bits so that decoding MP3s to WAVs
gives the CD quality that most people expect. You can specify
a higher precision before the output filename to keep this extra information.
.SP
.B Encoding
.SP
SoX can only read MP1 files, not write them.
.SP
SoX uses \fBtwolame\fR to write MP2 files, and the target bit rate is set
using the \fB\-C\fR option in kbps:
32, 48, 56, 64, 80, 96, 112, 128, 160 or 192 for a constant bit rate (CBR)
for mono files and double those for stereo ones.
Variable bit rate encoding (VBR) is selected by values from \(mi50 to \50
(of which only \(mi10 to 10 are said to be useful); if you really want
VBR at qualities 32 or 48, use something like 32.01 or 48.01.
.SP
Unfortunately, \fBtwolame\fR outputs 0.005 seconds of quiet garbage
at the start and truncates the end by 0.002 seconds.
.SP
It can also encode MP2s with \fB\-t\ sndfile\fR, which also uses
\fBtwolame\fR and has the same defect.
.SP
SoX uses libmp3lame to write MP3 files and can use up to
25 bits of precision but, at present, SoX's use of libmp3lame
adds 0.01 seconds of quiet garbage
at the start and at the end;
encoding with \fB\-t\ sndfile\fR gets the length right and no garbage.
.SP
MP3 compression parameters can be selected using SoX's \fB\-C\fR option
as follows:
.SP
The primary parameter to the LAME MP3 encoder is the bit rate. If the
value of the \fB\-C\fR value is a positive integer, it's taken as
the bitrate in kbps (e.g. if you specify 128, it uses 128 kbps).
.SP
The second most important parameter is "quality"
which allows balancing encoding speed vs. quality.
In LAME, 0 specifies highest quality but is very slow, while
9 selects poor quality, but is fast. (5 is the default and 2 is
recommended as a good trade-off for high quality encodes.)
.SP
Because the \fB\-C\fR value is a float, the fractional part is used
to select quality. 128.2 selects 128 kbps encoding with a quality
of 2. There is one problem with this approach. We need 128 to specify
128 kbps encoding with default quality, so 0 means use default. Instead
of 0 you have to use .01 (or .99) to specify the highest or lowest quality
(128.01 or 128.99).
.SP
LAME uses bitrate to specify a constant bitrate but higher quality
can be achieved using Variable Bit Rate (VBR). VBR quality (really
size) is selected using a number from 0 to 9. Use a value of 0 for high
quality, larger files and 9 for smaller files of lower quality. 4 is
the default.
.SP
In order to squeeze the selection of VBR into the the \fB\-C\fR value
we use negative numbers to select VBR. -4.2 would select default
VBR encoding (size) with high quality (speed). One special case is 0,
which is a valid VBR encoding parameter but not a valid bitrate.
Compression value of 0 is always treated as a high quality VBR, as a
result both -0.2 and 0.2 are treated as highest quality VBR (size) and
high quality (speed).
.RE
.TP
\fB.mp4\fR (with ffmpeg)
MPEG-4 video format.
.TP
\fB.mpeg\fR, \fB.mpg\fR (with ffmpeg)
MPEG-1 Systems / MPEG program stream format.
.TP
\fB.mpegts\fR (with ffmpeg)
MPEG-TS (MPEG-2 Transport Stream) format.
.TP
\fB.mul\fR
Tomb Raider Multiplex Stream (write-only support).
.TP
\fB.mxf\fR, \fB.mxf_opatom\fR (with ffmpeg)
Material eXchange Format Operational Pattern OP1A "OP-Atom" format (SMPTE 390M).
.TP
\fB.nist\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
See \fB.sph\fR.
.TP
\fB.nsp\fR (also with \fB\-t ffmpeg\fR)
SoX can read Computerized Speech Lab NSP files
that may contain both audio and bioelectric data.
Typically, the first channel is sound pressure (audio)
and additional channels are data such as
laryngeal kinematic or aerodynamic (air pressure or air flow).
.SP
The NSP file format was also used for the Phonetic Database (PDB)
from Speech Technology Research who had a free NSP Player, SpeakNSP.
CSL NSP file reading and writing is supported by the WaveSurfer package.
.TP
\fB.nut\fR (with ffmpeg)
NUT is a low overhead generic container format that stores audio, video,
subtitle and user-defined streams in a simple yet efficient way.
.TP
\fB.oga\fR (with ffmpeg)
Various Xiph.org audio formats in an Ogg container.
.TP
\fB.ogg\fR, \fB.vorbis\fR (optional, also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR))
Xiph.org's Ogg Vorbis compressed audio; an open, patent-free codec designed
for music and streaming audio. It is a lossy compression format that achieves
good compression rates with a minimal amount of quality loss.
.SP
SoX can decode all types of Ogg Vorbis files and can encode at different
compression levels/qualities given as a number from \-1 (highest
compression/lowest quality) to 10 (lowest compression, highest quality).
By default the encoding quality level is 3 (which gives an encoded rate
of approx. 112kbps) but this can be changed using the
.B \-C
option with a number from \-1 to 10; fractional numbers (e.g.
3\*d6) are also allowed.
Decoding is somewhat CPU intensive and encoding is very CPU intensive.
.TP
\fB.opus\fR (optional, also with \fB\-t sndfile\fR)
Xiph.org's Opus compressed audio is an open, lossy, low-latency codec
that uses the Ogg container.
.SP
It is said to supercede the other free codecs in terms of quality versus bit rate, but can only encode from a signal at
8, 12, 16, 24 or 48\ kHz sample rate, resampling other rates before encoding,
always decodes at 48kHz. It can handle up to 255 channels, and
The channel mappings for up to 8 channels are the same as the Vorbis mappings:
.RS
.TP
1
monophonic
.TP
2
stereo: left, right
.TP
3
a 1d-surround encoding: left, center, right
.TP
4
quadraphonic surround: front left, front right, rear left, rear right
.TP
5
five-channel surround: front left, center, front right, rear left, rear right
.TP
6
5.1 surround: front left, center, front right, rear left, rear right, LFE
.TP
7
6.1 surround: front left, center, front right, side left, side right, rear center, LFE
.TP
8
7.1 surround: front left, center, front right, side left, side right, rear left, rear right, LFE
.RE
.RS
.SP
As with \fBmp3\fR encoding, the bitrate can be set with \fB\-C\fR as
a floating-point number where
the integer part gives the bitrate in kbps from 6 to 256 kbps per channel,
negative values give a variable bit rate (VBR) and positive ones a
constant bit rate (CBR).
The fractional part gives the computational complexity from
0 (fastest, worst quality) to 10 (slowest, best quality).
If no fractional part is given, you get quality 10.
The quality is an integer rounded from the value given,
so to use a quality of 0, give a decimal part less than 0.05.
.SP
SoX can read and write Opus files; with \fB\-t sndfile\fR it can only read them.
.RE
.TP
\fBoss\fR (optional)
The Open Sound System /dev/dsp device driver supports both playing and
recording audio. OSS support is available in Unix-like operating systems,
sometimes together with alternative sound systems (such as ALSA). Examples:
.XE
sox_ng infile \-t oss
sox_ng infile \-t oss /dev/dsp
sox_ng \-b 16 \-t oss /dev/dsp outfile
.XX
.TP
\fB.paf\fR, \fB.fap\fR (with sndfile, also with \fB\-t ffmpeg\fB)
Ensoniq PARIS file format (big and little-endian respectively).
.TP
.B .pls
A
.I playlist
format containing a list of audio files.
SoX can read, but not write this file format.
See [2] for details of this format.
.SP
Note: SoX support for SHOUTcast PLS relies on
.BR wget (1)
and is only partially supported: it's necessary to
specify the audio type manually, e.g.
.XE
play \-t mp3 \(dqhttp://a.server/pls?rn=265&file=filename.pls\(dq
.XX
and SoX does not know about alternative servers\*mhit Ctrl-C twice in
quick succession to quit.
.TP
.B .pcm
Audio track format for the MSU-1 (Media Streaming Unit, revision 1),
an enhancement chip specification for the Super Nintendo Entertainment System
(SNES) / Super Famicom (SFC), designed by the late Byuu (aka Near).
Audio files are 44.1 kHz, 16-bit stereo uncompressed signed PCM in
little-endian order ("Red Book" CD audio is big-endian), left channel first.
They begin with an 8-byte header: the first four bytes are "MSU1" in ASCII
and the next four are a 32-bit unsigned integer that define the loop point
in samples.
.TP
.B .prc
Psion Record are used in Psion EPOC PDAs (Series 5, Revo and similar) for
System alarms and recordings made by the built-in Record application.
When writing, SoX defaults to A-law, which is recommended; if you must
use ADPCM, use the \fB\-e ima-adpcm\fR switch. The sound quality is poor
because Psion Record seems to insist on frames of 800 samples or
fewer, so that the ADPCM CODEC has to be reset at every 800 frames,
which causes the sound to glitch every tenth of a second.
.TP
\fBpulseaudio\fR (optional)
PulseAudio is a cross-platform networked sound server.
The PulseAudio driver supports both playing and recording of audio.
.SP
If a file name is given to this driver, it selects the pulse server,
the audio source or sink device and/or the application name under which SoX
registers itself with PulseAudio.
\fBapp:foo\fR changes the application name
from the default of \fBSoX\fR, anything else with a colon on it
is a server name and anything without a colon is the device name.
To specify more than one of these, or multiple servers to try in sequence,
use a single filename with the entries separated by spaces;
as application names can contain spaces, an "app:" field must come last.
For example:
.XE
sox_ng in.au \-t pulseaudio alsa_output.pci-0000_01_00.1.hdmi-stereo
.XX
.SP
Where \fBpactl list sinks short\fR gives a list of playing devices and
\fBpactl list sources short\fR a list of recording devices.
.SP
You can also set the PulseAudio device with SoX's \fBAUDIODEV\fP
and PulseAudio's \fBPULSE_SOURCE\fR and \fBPULSE_SINK\fR environment variables
(\fBAUDIODEV\fR overrides \fBPULSE_*\fR and a filename overrides both) and
the server with \fBPULSE_SERVER\fR. For details of the server name's syntax,
search for "pulseaudio format of server strings".
.TP
\fB.pvf\fR (with sndfile)
Portable Voice Format.
.TP
\fB.ra\fR (with ffmpeg)
RealAudio format.
.TP
\fBraw\fR
Headerless audio data. See the first entry in this list for details.
.TP
\fB.rm\fR (with ffmpeg)
RealMedia format.
.TP
\fB.rso\fR (with ffmpeg)
Lego Mindstorms RSO format.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.rso', you will need to prefix it with `-t\ ffmpeg'.
.TP
\fB.sbc\fR (with ffmpeg)
Bluetooth SIG low-complexity subband audio format.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.sbc', you will need to prefix it with `-t\ ffmpeg'.
.TP
\fB.sd2\fR (with sndfile)
Sound Designer 2 format.
.TP
\fB.sds\fR (with sndfile, also with \fB\-t ffmpeg\fR)
MIDI Sample Dump Standard.
.TP
\fB.sf\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
IRCAM SDIF (Institut de Recherche et Coordination Acoustique/Musique
Sound Description Interchange Format) is used by academic music software
such as the CSound package and the MixView sound sample editor.
.TP
\fB.sln\fR (also with \fB\-t ffmpeg\fR)
Asterisk PBX `signed linear' 8khz, 16-bit signed integer, little-endian
raw format.
.TP
\fB.smjpeg\fR (with ffmpeg)
Loki SDL MJPEG.
.TP
.B .smp
SMP files are for use with the PC-DOS package SampleVision by Turtle Beach
Softworks, which communicates with several MIDI samplers.
All sample rates are supported by the package although not all are supported
by the samplers themselves.
Loop points are currently ignored.
.TP
.B .snd
Several file formats use the \fB.snd\fR extension.
.SP
The main one was by NeXT, essentially the same as Sun Microsystems'
\fB.au\fR format - see \fB.au\fR
.SP
Apple made another \fB.snd\fR format in which the first two bytes
are a 16-bit integer representing the numbers 1 or 2 but which
can often be read as a raw format.
.SP
Akai had a \fB.snd\fR file format for its MPC range of samplers
of which the first byte contains the number 1
and the second the number 4. See \fB.mpc2k\fR
.SP
There are also Sounder and SoundTool files
from MS-DOS/Windows in the early '90s.
See \fB.sndr\fR and \fB.sndt\fR.
.SP
Lastly, the HOM-BOT Robot Vacuum Cleaner and the
V.Flash Home Entertainment System use \fB.snd\fP audio files
which are raw single-channel 16-bit 16kHz PCM
and the Unity Game Engine uses a compressed format called \fB.snd\fP.
.TP
\fBsndfile\fR (optional)
This is a pseudo-type that forces libsndfile to be used.
For writing files, the actual file type is taken from the output file name;
for reading them, it is deduced from the file.
.TP
\fBsndio\fR (optional)
The OpenBSD audio device driver supports both playing and recording audio.
.TP
.B .sndr
Sounder files are an MS-DOS/Windows format from the early '90s
that usually have the extension `.snd'.
.TP
.B .sndt
SoundTool files are another MS-DOS/Windows format from the early '90s
that usually have the extension `.snd'.
.TP
.B .sou
An alias for the
.B .u8
raw format.
.TP
\fB.sox\fR (also with \fB\-t ffmpeg\fR)
SoX's native uncompressed PCM format is intended for storing or piping
audio at intermediate processing points between SoX invocations.
It has much in common with WAV, AIFF and AU uncompressed PCM
formats but has the following specific characteristics: the PCM samples
are stored as 32 bit signed integers, the samples are stored (by
default) as `native endian' and the number of samples in the file is
recorded as a 64-bit integer. Comments are also supported.
.SP
See the section `\fBSpecial Filenames\fR' in
.BR sox_ng (1)
for examples of using the
.B .sox
format with pipes.
.TP
\fB.spdif\fR (with ffmpeg)
IEC 61937 S/PDIF format.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.spdif', you will need to prefix it with `-t\ ffmpeg'.
.TP
\fB.sph\fR, \fB.nist\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
SPHERE (SPeech HEader REsources) is a file format defined by NIST
(National Institute of Standards and Technology) and is used with
speech audio. SoX can read these files when they contain
\(*m-law and PCM data. It will ignore header information that
says the data is compressed using \fIshorten\fR compression and
will treat the data as either \(*m-law or PCM.
SoX and the command line \fIshorten\fR program can be run together using
pipes to encompasses the data and then pass the result to SoX for processing.
.TP
\fB.spx\fR, \fB.speex\fR (with ffmpeg)
Ogg Speex format is for high compression of speech that, in VBR mode,
achieves higher quality than AMR or GSM, but is now considered
superseded by their more recent Opus codec.
.TP
\fBsunau\fR (optional)
The Sun /dev/audio device driver supports both playing and
recording audio. For example:
.XE
sox_ng infile \-t sunau /dev/audio
.XX
or
.XE
sox_ng infile \-t sunau \-e mu-law \-c 1 /dev/audio
.XX
for older Sun equipment.
.SP
.TP
\fB.svcd\fR (with ffmpeg)
Another name for
.BR .mov .
.TP
\fB.tta\fR (with ffmpeg)
True Audio format.
.TP
\fB.vag\fR (with ffmpeg)
Sony PS2 VAG format.
.TP
.B .txw
TXW is a file format from the Yamaha TX-16W sampling keyboard which wrote
samples onto IBM/PC-format 3\*d5\(dq floppies at sample rates of 16kHz,
33kHz and 50kHz, all exact divisors of 100kHz.
.SP
SoX handles reading of files which do not have the sample rate field set
to one of the expected rates by looking at some other bytes
in the attack/loop length fields
and defaulting to 33kHz if the sample rate is still unknown.
.TP
\fB.vcd\fR (with ffmpeg)
Another name for
.BR .mov .
.TP
.B .vms
See
.BR .dvms .
.TP
\fB.vob\fR (with ffmpeg)
Another name for
.BR .mov .
.TP
\fB.voc\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
Sound Blaster VOC files are multi-part and contain silence parts,
looping and different sample rates for different chunks.
On input, the silence parts are filled out, loops are rejected,
and sample data with a new sample rate is rejected.
Silence with a different sample rate is generated appropriately.
On output, silence is not detected, nor are impossible sample rates.
SoX reads but cannot write VOC files with multiple blocks
and files containing \(*m-law, A-law and 2/3/4-bit ADPCM samples.
.TP
.B .vorbis
See
.BR .ogg .
.TP
\fB.vox\fR
Headerless files of Dialogic/OKI ADPCM audio data commonly come with the
extension .vox. This ADPCM data has 12-bit precision packed into only 4-bits.
.SP
Note: some early Dialogic hardware does not always reset the ADPCM
encoder at the start of each vox file. This can result in clipping
and/or DC offset problems when it comes to decoding the audio.
While little can be done about the clipping, a DC offset can be removed by
passing the decoded audio through a high-pass filter, e.g.:
.XE
sox_ng input.vox output.wav highpass 10
.XX
.TP
\fB.w64\fR (with sndfile, also with \fB\-t ffmpeg\fR)
Sonic Foundry's 64-bit RIFF/WAV format.
.SP
SoX can only autodetect this type of file from its filename extension;
if it is read from `standard input' (stdin) or from a file whose name
does not end in `.w64', you will need to prefix it with `-t\ w64'.
.TP
\fB.wav\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
Microsoft .WAV RIFF files are the native audio file format of Windows
and widely used for uncompressed audio.
.SP
Normally \fB.wav\fR files have all formatting information
in their headers, so format options do not usually need to be
specified for input files. If any are, they
override the file header and you will be warned to this effect.
Output format options will cause a format conversion and the \fB.wav\fR
is written appropriately.
.SP
SoX can read and write linear PCM, floating point, \(*m-law, A-law, MS ADPCM
and IMA (or DVI) ADPCM-encoded samples.
WAV files can also contain audio encoded in other ways not currently
supported with SoX (e.g. MP3); in some cases such a file can still be
read by SoX by overriding the file type, e.g.
.XE
play \-t mp3 mp3\-encoded.wav
.XX
.SP
Natively, SoX can only read WAV files with a bit-depth of 8, 16, 24 or 32;
files with other bit-depths can be read by preceding them with \f(CW\-t\ sndfile\fR.
.SP
Big endian versions of RIFF files, called RIFX, are also supported.
To write a RIFX file, use the
.B \-B
output file option.
.SP
See also \fB.wavpcm\fR.
.TP
\fBwaveaudio\fR (optional)
The MS-Windows native audio device driver. Examples:
.XE
sox_ng infile \-t waveaudio
sox_ng infile \-t waveaudio default
sox_ng infile \-t waveaudio 1
sox_ng infile \-t waveaudio "High Definition Audio Device"
.XX
If the device name is omitted, \fB-1\fR, or \fBdefault\fR, you
get the `Microsoft Wave Mapper' device. Wave Mapper means `use the
system default audio devices' and you can control what `default' means
via the OS Control Panel.
.SP
If the given device name is some other number, you get that audio
device by its index, so recording with device name \fB0\fR would get the
first input device (perhaps the microphone), \fB1\fR would get the
second (perhaps line in), etc. Playback using device name \fB0\fR
will get the first output device (usually the only audio device).
.SP
If the given device name is something other than a number, SoX tries
to match it (to a maximum of 31 characters)
against the names of the available devices.
.SP
.TP
.B .wavpcm
A non-standard but widely used variant of
.BR .wav .
Some applications cannot read a standard WAV file header for PCM-encoded
data with a sample size greater than 16 bits or with more than two
channels but can read a non-standard WAV header.
It is likely that such applications will eventually be updated
to support the standard header but, in the mean time, this SoX
format can be used to create files with the non-standard header that
should work with these applications.
SoX will automatically detect and read WAV files with a non-standard header.
.SP
The most common use of this file type is likely to be along the following
lines:
.XE
sox_ng infile.any \-t wavpcm \-e signed-integer outfile.wav
.XX
.TP
\fB.webm\fR (with ffmpeg)
See \fB.mkv\fR.
.TP
\fB.wma\fR (with ffmpeg)
Windows Media Audio format.
.TP
\fB.wsaud\fR (with ffmpeg)
Westwood Studios audio format.
.TP
\fB.wsd\fR
Wideband Single-bit Data is the same as \fB.dsf\fP but with a different header.
.TP
\fB.wtv\fR (with ffmpeg)
Windows Television format.
.TP
\fB.wv\fR (also with \fB\-t sndfile\fR or \fB\-t ffmpeg\fR)
WavPack lossless audio compression. Note that, when converting
.B .wav
to this format and back again,
the RIFF header is not necessarily preserved losslessly, though the audio is.
.TP
\fB.wve\fR (also with \fB\-t sndfile\fR)
Psion 8-bit A-law is used on Psion SIBO PDAs (Series 3 and similar).
.TP
\fB.xa\fR (also with \fB\-t ffmpeg\fR)
Maxis XA files are 16-bit ADPCM audio files used by Maxis games.
Writing \fB.xa\fR files is currently not supported,
although adding write support should not be very difficult.
.TP
\fB.xi\fR (with sndfile)
Fasttracker 2 Extended Instrument format.
.ne 3
.SH REFERENCES
.TP
[1]
Wikipedia,
.IR "M3U" ,
http://en.wikipedia.org/wiki/M3U
.TP
[2]
Wikipedia,
.IR "PLS" ,
http://en.wikipedia.org/wiki/PLS_(file_format)
.ne 2
.SH SEE ALSO
.BR sox_ng (1),
\f(CWhttps://codeberg.org/sox_ng\fR
.SH AUTHORS
Lance Norskog, Chris Bagwell and many other authors and contributors
listed in the README file that is distributed with the source code.