User Commands 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 dataencodings, such as -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 must be specifiedwith 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 ofthe 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 con-
catenated together. The output file will contain 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 out-
put 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 The following options are supported:SunOS 5.11 Last change: 16 Feb 2001 1
User Commands audioconvert(1)
-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 berewritten. The -o option may not be specified
with -p.
-F Force: This option forces audioconvert to
ignore any file header for input files whoseformat 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: This option is used to specify
the file format and data encoding of the out-
put file. Defaults for unspecified fields arederived from the input file format. Valid key-
words and values are listed in the next sec-
tion.-o outfile Output File: All input files are concatenated,
converted to the output format, and written tothe named output file. If -o and -p are not
specified, the concatenated output is writtento the standard output. The -p option may not
be specified with -o.
-i infmt Input Format: This option is used to specify
the data encoding of raw input files. Ordi-
narily, the input data format is derived from the audio file header. This option is requiredwhen converting audio data that is not pre-
ceded by a valid audio file header. If -i is
specified for an input file that contains an audio file header, the input format stringwill be ignored, unless -F is present. The
format specification syntax is the same as the-f output file format.
Multiple input formats may be specified. Aninput format describes all input files follow-
ing that specification, until a new input for-
mat is specified. file File Specification: The named audio files are concatenated, converted to the output format,SunOS 5.11 Last change: 16 Feb 2001 2
User Commands audioconvert(1)
and written out. If no file name is present,or if the special file name `-' is specified,
audio data is read from the standard input.-? Help: Prints 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. Unambiguous 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 of the commonly used sample rates are: 8k, 16k, 32k, 44.1k, and 48k. channels The number of interleaved channels is specified as an integer. The words mono and stereo may also be used to specify one and two channel data, respectively. encoding This option specifies the digital audio data representation. Encodings determine precisionimplicitly (ulaw implies 8-bit precision) or
explicitly as part of the name (for example, linear16). Valid encoding values are:ulaw CCITT G.711 -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. linear8, Linear Pulse Code Modulation (PCM) linear16, encoding. The name identifies the linear32 number of bits of precision. linear16 is typically used for high quality audio data.SunOS 5.11 Last change: 16 Feb 2001 3
User Commands audioconvert(1)
pcm Same as linear16. g721 CCITT G.721 compression format. This encoding uses Adaptive Delta Pulse Code Modulation (ADPCM) with4-bit precision. It is primarily
used for compressing -law voice
data (achieving a 2:1 compression ratio). g723 CCITT G.723 compression format. This encoding uses Adaptive Delta Pulse Code Modulation (ADPCM) with3-bit precision. It is primarily
used for compressing -law voice
data (achieving an 8:3 compressionratio). The audio quality is simi-
lar to G.721, but may result inlower quality when used for non-
speech data. The following encoding values are also accepted as shorthand to set the sample rate, channels, and encoding: voice Equivalent to encoding=ulaw,rate=8k,channels=mono. cd Equivalent to encoding=linear16,rate=44.1k,channels=stereo. dat Equivalent to encoding=linear16,rate=48k,channels=stereo. format This option specifies the audio file format. Valid formats are: 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.SunOS 5.11 Last change: 16 Feb 2001 4
User Commands audioconvert(1)
offset (-i only) Specifies a byte offset to locate the
start of the audio data. This option may be usedto import audio data that contains an unrecog-
nized file header.USAGE
See largefile(5) for the description of the behavior ofaudioconvert when encountering files greater than or equal
to 2 Gbyte ( 2^31 bytes).EXAMPLES
Example 1 Recording and compressing voice data before stor-
ing it Record voice data and compress it before storing it to a file:example% audiorecord | audioconvert -f g721 > mydata.au
Example 2 Concatenating two audio files Concatenate two Sun format audio files, regardless of theirdata format, and output an 8-bit ulaw, 16 kHz, mono file:
example% audioconvert -f ulaw,rate=16k,mono -o outfile.au infile1 infile2
Example 3 Converting a directory to Sun format Convert a directory containing raw voice data files, in place, to Sun format (adds a file header to each file):example% audioconvert -p -i voice -f sun *.au
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:SunOS 5.11 Last change: 16 Feb 2001 5
User Commands audioconvert(1)
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Architecture | SPARC, x86 ||_____________________________|_____________________________|
| Availability | audio/audio-utilities |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
SEE ALSO
audioplay(1), audiorecord(1), file(1), attributes(5), large-
file(5) NOTESThe algorithm used for converting multi-channel 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 mono file is converted to stereo and back to mono), the resulting data may contain some distortion.SunOS 5.11 Last change: 16 Feb 2001 6