audioconvert(1)
NAME
audioconvert − convert audio file formats
SYNOPSIS
audioconvert [ −pF ] [ −f outfmt ] [ −o outfile ] [ [ −i infmt ] [ file... ] ] ...
DESCRIPTION
audioconvert converts audio data between a set of supported audio encodings and file formats. It can be used to compress and decompress audio data, to add audio file headers to raw audio data files, and to convert between standard data encodings, such as u-law and linear PCM.
If no filenames are present, audioconvert reads the data from the standard input stream and writes an audio file to the standard output. Otherwise, input files are processed in order, concatenated, and written to the output file.
Input files are expected to contain audio file headers that identify the audio data format. If the audio data does not contain a recognizable header, the format may be specified by the −i option, using the rate, encoding, and channels keywords to identify the input data format.
The output file format is derived by updating the format of the first input file with the format options in the −f specification. If −p is not specified, all subsequent input files are converted to this resulting format and concatenated together. The output file contains an audio file header, unless format=raw is specified in the output format options.
Input files may be converted in place by using the −p option. When −p is in effect, the format of each input file is modified according to the −f option to determine the output format. The existing files are then overwritten with the converted data.
The file(1) command decodes and prints the audio data format of Sun audio files.
OPTIONS
−p In Place: The input files are individually converted to the format specified by the −f option and rewritten. If a target file is a symbolic link, the underlying file will be rewritten. The −o option may not be specified with −p.
−F Force: This option forces audioconvert to ignore any file header for input files whose format is specified by the −i option. If −F is not specified, audioconvert ignores the −i option for input files that contain valid audio file headers.
−f outfmt Output Format: The output format describes the format and encoding of the output file. Defaults for unspecified fields are derived from the input file format. Valid keywords and values are listed in the next section.
−o outfile Output File: All input files are concatenated, converted to the output format, and written to the named output file. If −o and −p are not specified, the concatenated output is written to the standard output. The −p option may not be specified with −o.
−i infmt Input Format: Specify the encoding and format of the input file(s). Ordinarily, the input data format is derived from the audio file header. This option is required when converting raw input data, in order to describe the audio format. If −i is specified for an input file that contains a valid audio file header, the input format string will be ignored, unless −F is present. The format specification string is the same as that used to describe the output file format.
Multiple input formats may be specified. An input format describes all input files following that specification, until a new input format is specified.
file File Specification: The named audio file(s) are concatenated, converted to the output format, and written out. If no filename is present, or if the special filename ‘−’ is specified, audio data is read from the standard input.
−? Help: Print a command line usage message.
FORMAT SPECIFICATION
The syntax for the input and output format specification is:
keyword=value[,keyword=value ...]
with no intervening whitespace. Format keywords and values may be abbreviated as long as they are uniquely identifiable. Alphabetic values may be used without the preceding keyword=.
rate The audio sampling rate is specified in samples per second. If a number is followed by the letter k, it is multiplied by 1000 (for example, 44.1k = 44100). Standard sample rates are: 8k, 16k, 32k, 44.1k (CD quality), and 48k (DAT quality).
channels The number of interleaved channels. The words mono and stereo may be used to specify one and two channel data, respectively.
encoding This field describes the data encoding for digital audio data. Encodings determine precision implicitly (ulaw implies 8-bit precision) or explicitly as part of the name (for example, pcm16). Valid encoding values are:
ulaw CCITT G.711 u-law encoding. This is an 8-bit format primarily used for telephone quality speech.
alaw CCITT G.711 A-law encoding. This is an 8-bit format primarily used for telephone quality speech in Europe.
pcm8, pcm16, pcm24, pcm32
Linear Pulse Code Modulation (PCM) encoding, used for CD and DAT audio data. The name identifies the number of bits of precision.
pcm Same as pcm16.
g721 CCITT G.721 compression format. This encoding uses Adaptive Delta Pulse Code Modulation (ADPCM) with 4 bit precision. It is primarily used for compressing 8 kHz u-law data (achieving a 2:1 compression ratio).
The following encoding values are also accepted as shorthand to set the sample rate, number of channels, and data encoding:
voice Equivalent to encoding=ulaw,rate=8k,channels=mono.
cd Equivalent to encoding=pcm16,rate=44.1k,channels=stereo.
dat Equivalent to encoding=pcm16,rate=48k,channels=stereo.
format Specify the audio file format. Valid formats include:
sun Sun compatible file format (the default).
raw Use this format when reading or writing raw audio data (with no audio header), or in conjunction with an offset to import a foreign audio file format.
offset (raw input format only) Specify a byte offset to locate the start of the audio data. This option may be used to import an audio file that contains an unrecognized file header.
EXAMPLES
Record voice data and compress it before storing it to a file:
example% audiorecord | audioconvert −f g721 > mydata.au
Concatenate two Sun format audio files and output a single 8-bit 8 kHz u-law file:
example% audioconvert −f ulaw −o outfile.au infile1 infile2
Convert a directory containing raw u-law data files, in place, to Sun format (that is, add a file header):
example% audioconvert −p −i ulaw −f sun ∗.au
SEE ALSO
audioplay(1), audiorecord(1), file(1)
BUGS
Mono and stereo are the only multi-channel data types currently supported.
The algorithm used for converting stereo data to mono is implemented by simply summing the channels together. If the input data is perfectly in phase (as would be the case if a single channel file was converted to stereo), the resulting data may contain some distortion.
SunOS 5.1 — Last change: 27 Jul 1992