1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
'\" te
.\" Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH AUDIOCONVERT 1 "Feb 8, 2020"
.SH NAME
audioconvert \- convert audio file formats
.SH SYNOPSIS
.nf
\fBaudioconvert\fR [\fB-pF\fR] [\fB-f\fR \fIoutfmt\fR] [\fB-o\fR \fIoutfile\fR]
[ [\fB-i\fR \fIinfmt\fR] [\fIfile\fR]...] ...
.fi
.SH DESCRIPTION
\fBaudioconvert\fR 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.
.sp
.LP
If no filenames are present, \fBaudioconvert\fR 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.
.sp
.LP
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 specified with the \fB-i\fR option, using the \fBrate\fR,
\fBencoding\fR, and \fBchannels\fR keywords to identify the input data format.
.sp
.LP
The output file format is derived by updating the format of the first input
file with the format options in the \fB-f\fR specification. If \fB-p\fR is not
specified, all subsequent input files are converted to this resulting format
and concatenated together. The output file will contain an audio file header,
unless \fBformat\fR=\fIraw\fR is specified in the output format options.
.sp
.LP
Input files may be converted in place by using the \fB-p\fR option. When
\fB-p\fR is in effect, the format of each input file is modified according to
the \fB-f\fR option to determine the output format. The existing files are then
overwritten with the converted data.
.sp
.LP
The \fBfile\fR(1) command decodes and prints the audio data format of Sun audio
files.
.SH OPTIONS
The following options are supported:
.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 14n
\fIIn Place\fR: The input files are individually converted to the format
specified by the \fB-f\fR option and rewritten. If a target file is a symbolic
link, the underlying file will be rewritten. The \fB-o\fR option may not be
specified with \fB-p\fR.
.RE
.sp
.ne 2
.na
\fB\fB-F\fR\fR
.ad
.RS 14n
\fIForce\fR: This option forces \fBaudioconvert\fR to ignore any file header
for input files whose format is specified by the \fB-i\fR option. If \fB-F\fR
is not specified, \fBaudioconvert\fR ignores the \fB-i\fR option for input
files that contain valid audio file headers.
.RE
.sp
.ne 2
.na
\fB\fB-f\fR \fIoutfmt\fR\fR
.ad
.RS 14n
\fIOutput Format\fR: This option is used to specify the file format and data
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.
.RE
.sp
.ne 2
.na
\fB\fB-o\fR \fIoutfile\fR\fR
.ad
.RS 14n
\fIOutput File\fR: All input files are concatenated, converted to the output
format, and written to the named output file. If \fB-o\fR and \fB-p\fR are not
specified, the concatenated output is written to the standard output. The
\fB-p\fR option may not be specified with \fB-o\fR.
.RE
.sp
.ne 2
.na
\fB\fB-i\fR \fIinfmt\fR\fR
.ad
.RS 14n
\fIInput Format\fR: This option is used to specify the data encoding of raw
input files. Ordinarily, the input data format is derived from the audio file
header. This option is required when converting audio data that is not preceded
by a valid audio file header. If \fB-i\fR is specified for an input file that
contains an audio file header, the input format string will be ignored, unless
\fB-F\fR is present. The format specification syntax is the same as the
\fB-f\fR output file format.
.sp
Multiple input formats may be specified. An input format describes all input
files following that specification, until a new input format is specified.
.RE
.sp
.ne 2
.na
\fB\fIfile\fR\fR
.ad
.RS 14n
\fIFile Specification\fR: The named audio files are concatenated, converted to
the output format, and written out. If no file name is present, or if the
special file name `\(mi' is specified, audio data is read from the standard
input.
.RE
.sp
.ne 2
.na
\fB\fB-?\fR\fR
.ad
.RS 14n
\fIHelp\fR: Prints a command line usage message.
.RE
.SS "Format Specification"
The syntax for the input and output format specification is:
.sp
.LP
\fIkeyword\fR=\fIvalue\fR[,\fIkeyword\fR=\fIvalue\fR \|.\|.\|.\|]
.sp
.LP
with no intervening whitespace. Unambiguous values may be used without the
preceding \fIkeyword\fR=.
.sp
.ne 2
.na
\fB\fBrate\fR\fR
.ad
.RS 12n
The audio sampling rate is specified in samples per second. If a number is
followed by the letter \fBk\fR, 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.
.RE
.sp
.ne 2
.na
\fB\fBchannels\fR\fR
.ad
.RS 12n
The number of interleaved channels is specified as an integer. The words
\fBmono\fR and \fBstereo\fR may also be used to specify one and two channel
data, respectively.
.RE
.sp
.ne 2
.na
\fB\fBencoding\fR\fR
.ad
.RS 12n
This option specifies the digital audio data representation. Encodings
determine precision implicitly (\fBulaw\fR implies 8-bit precision) or
explicitly as part of the name (for example, \fBlinear16\fR). Valid encoding
values are:
.sp
.ne 2
.na
\fB\fBulaw\fR\fR
.ad
.RS 13n
\fBCCITT G.711\fR u-law encoding. This is an 8-bit format primarily used for
telephone quality speech.
.RE
.sp
.ne 2
.na
\fB\fBalaw\fR\fR
.ad
.RS 13n
\fBCCITT G.711\fR A-law encoding. This is an 8-bit format primarily used for
telephone quality speech in Europe.
.RE
.sp
.ne 2
.na
\fB\fBlinear8\fR,\fR
.ad
.br
.na
\fB\fBlinear16\fR,\fR
.ad
.br
.na
\fB\fBlinear32\fR\fR
.ad
.RS 13n
Linear Pulse Code Modulation (PCM) encoding. The name identifies the number of
bits of precision. \fBlinear16\fR is typically used for high quality audio
data.
.RE
.sp
.ne 2
.na
\fB\fBpcm\fR\fR
.ad
.RS 13n
Same as \fBlinear16\fR.
.RE
.sp
.ne 2
.na
\fB\fBg721\fR\fR
.ad
.RS 13n
\fBCCITT G.721\fR compression format. This encoding uses Adaptive Delta Pulse
Code Modulation (ADPCM) with 4-bit precision. It is primarily used for
compressing u-law voice data (achieving a 2:1 compression ratio).
.RE
.sp
.ne 2
.na
\fB\fBg723\fR\fR
.ad
.RS 13n
\fBCCITT G.723\fR compression format. This encoding uses Adaptive Delta Pulse
Code Modulation (ADPCM) with 3-bit precision. It is primarily used for
compressing u-law voice data (achieving an 8:3 compression ratio). The audio
quality is similar to \fBG.721,\fR but may result in lower quality when used
for non-speech data.
.RE
The following encoding values are also accepted as shorthand to set the sample
rate, channels, and encoding:
.sp
.ne 2
.na
\fB\fBvoice\fR\fR
.ad
.RS 9n
Equivalent to \fBencoding=ulaw,rate=8k,channels=mono\fR.
.RE
.sp
.ne 2
.na
\fB\fBcd\fR\fR
.ad
.RS 9n
Equivalent to \fBencoding=linear16,rate=44.1k,channels=stereo\fR.
.RE
.sp
.ne 2
.na
\fB\fBdat\fR\fR
.ad
.RS 9n
Equivalent to \fBencoding=linear16,rate=48k,channels=stereo\fR.
.RE
.RE
.sp
.ne 2
.na
\fB\fBformat\fR\fR
.ad
.RS 12n
This option specifies the audio file format. Valid formats are:
.sp
.ne 2
.na
\fB\fBsun\fR\fR
.ad
.RS 7n
Sun compatible file format (the default).
.RE
.sp
.ne 2
.na
\fB\fBraw\fR\fR
.ad
.RS 7n
Use this format when reading or writing raw audio data (with no audio header),
or in conjunction with an \fBoffset\fR to import a foreign audio file format.
.RE
.RE
.sp
.ne 2
.na
\fB\fBoffset\fR\fR
.ad
.RS 12n
(\fB-i\fR \fIonly\fR) Specifies a byte offset to locate the start of the audio
data. This option may be used to import audio data that contains an
unrecognized file header.
.RE
.SH USAGE
See \fBlargefile\fR(5) for the description of the behavior of
\fBaudioconvert\fR when encountering files greater than or equal to 2 Gbyte
(2^31 bytes).
.SH EXAMPLES
\fBExample 1 \fRRecording and compressing voice data before storing it
.sp
.LP
Record voice data and compress it before storing it to a file:
.sp
.in +2
.nf
example% \fBaudiorecord | audioconvert -f g721 > mydata.au\fR
.fi
.in -2
.sp
.LP
\fBExample 2 \fRConcatenating two audio files
.sp
.LP
Concatenate two Sun format audio files, regardless of their data format, and
output an 8-bit ulaw, 16 kHz, mono file:
.sp
.in +2
.nf
example% \fBaudioconvert -f ulaw,rate=16k,mono -o outfile.au infile1 infile2\fR
.fi
.in -2
.sp
.LP
\fBExample 3 \fRConverting a directory to Sun format
.sp
.LP
Convert a directory containing raw voice data files, in place, to Sun format
(adds a file header to each file):
.sp
.in +2
.nf
example% \fBaudioconvert -p -i voice -f sun *.au\fR
.fi
.in -2
.sp
.SH SEE ALSO
\fBaudioplay\fR(1), \fBaudiorecord\fR(1), \fBfile\fR(1),
\fBlargefile\fR(5)
.SH NOTES
The 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.
|