1audioconvert(1) User Commands audioconvert(1)
2
3
4
6 audioconvert - convert audio file formats
7
9 audioconvert [-pF] [-f outfmt] [-o outfile]
10 [ [-i infmt] [file]...] ...
11
12
14 audioconvert converts audio data between a set of supported audio
15 encodings and file formats. It can be used to compress and decompress
16 audio data, to add audio file headers to raw audio data files, and to
17 convert between standard data encodings, such as -law and linear PCM.
18
19
20 If no filenames are present, audioconvert reads the data from the stan‐
21 dard input stream and writes an audio file to the standard output. Oth‐
22 erwise, input files are processed in order, concatenated, and written
23 to the output file.
24
25
26 Input files are expected to contain audio file headers that identify
27 the audio data format. If the audio data does not contain a recogniz‐
28 able header, the format must be specified with the -i option, using the
29 rate, encoding, and channels keywords to identify the input data for‐
30 mat.
31
32
33 The output file format is derived by updating the format of the first
34 input file with the format options in the -f specification. If -p is
35 not specified, all subsequent input files are converted to this result‐
36 ing format and concatenated together. The output file will contain an
37 audio file header, unless format=raw is specified in the output format
38 options.
39
40
41 Input files may be converted in place by using the -p option. When -p
42 is in effect, the format of each input file is modified according to
43 the -f option to determine the output format. The existing files are
44 then overwritten with the converted data.
45
46
47 The file(1) command decodes and prints the audio data format of Sun
48 audio files.
49
51 The following options are supported:
52
53 -p In Place: The input files are individually converted to
54 the format specified by the -f option and rewritten. If a
55 target file is a symbolic link, the underlying file will
56 be rewritten. The -o option may not be specified with -p.
57
58
59 -F Force: This option forces audioconvert to ignore any file
60 header for input files whose format is specified by the
61 -i option. If -F is not specified, audioconvert ignores
62 the -i option for input files that contain valid audio
63 file headers.
64
65
66 -f outfmt Output Format: This option is used to specify the file
67 format and data encoding of the output file. Defaults for
68 unspecified fields are derived from the input file for‐
69 mat. Valid keywords and values are listed in the next
70 section.
71
72
73 -o outfile Output File: All input files are concatenated, converted
74 to the output format, and written to the named output
75 file. If -o and -p are not specified, the concatenated
76 output is written to the standard output. The -p option
77 may not be specified with -o.
78
79
80 -i infmt Input Format: This option is used to specify the data
81 encoding of raw input files. Ordinarily, the input data
82 format is derived from the audio file header. This option
83 is required when converting audio data that is not pre‐
84 ceded by a valid audio file header. If -i is specified
85 for an input file that contains an audio file header, the
86 input format string will be ignored, unless -F is
87 present. The format specification syntax is the same as
88 the -f output file format.
89
90 Multiple input formats may be specified. An input format
91 describes all input files following that specification,
92 until a new input format is specified.
93
94
95 file File Specification: The named audio files are concate‐
96 nated, converted to the output format, and written out.
97 If no file name is present, or if the special file name
98 `−' is specified, audio data is read from the standard
99 input.
100
101
102 -? Help: Prints a command line usage message.
103
104
105 Format Specification
106 The syntax for the input and output format specification is:
107
108
109 keyword=value[,keyword=value ...]
110
111
112 with no intervening whitespace. Unambiguous values may be used without
113 the preceding keyword=.
114
115 rate The audio sampling rate is specified in samples per second.
116 If a number is followed by the letter k, it is multiplied
117 by 1000 (for example, 44.1k = 44100). Standard of the com‐
118 monly used sample rates are: 8k, 16k, 32k, 44.1k, and 48k.
119
120
121 channels The number of interleaved channels is specified as an inte‐
122 ger. The words mono and stereo may also be used to specify
123 one and two channel data, respectively.
124
125
126 encoding This option specifies the digital audio data representa‐
127 tion. Encodings determine precision implicitly (ulaw
128 implies 8-bit precision) or explicitly as part of the name
129 (for example, linear16). Valid encoding values are:
130
131 ulaw CCITT G.711 -law encoding. This is an 8-bit
132 format primarily used for telephone quality
133 speech.
134
135
136 alaw CCITT G.711 A-law encoding. This is an 8-bit
137 format primarily used for telephone quality
138 speech in Europe.
139
140
141 linear8, Linear Pulse Code Modulation (PCM) encoding.
142 linear16, The name identifies the number of bits of pre‐
143 linear32 cision. linear16 is typically used for high
144 quality audio data.
145
146
147 pcm Same as linear16.
148
149
150 g721 CCITT G.721 compression format. This encoding
151 uses Adaptive Delta Pulse Code Modulation
152 (ADPCM) with 4-bit precision. It is primarily
153 used for compressing -law voice data (achiev‐
154 ing a 2:1 compression ratio).
155
156
157 g723 CCITT G.723 compression format. This encoding
158 uses Adaptive Delta Pulse Code Modulation
159 (ADPCM) with 3-bit precision. It is primarily
160 used for compressing -law voice data (achiev‐
161 ing an 8:3 compression ratio). The audio qual‐
162 ity is similar to G.721, but may result in
163 lower quality when used for non-speech data.
164
165 The following encoding values are also accepted as short‐
166 hand to set the sample rate, channels, and encoding:
167
168 voice Equivalent to encoding=ulaw,rate=8k,channels=mono.
169
170
171 cd Equivalent to encoding=linear16,rate=44.1k,chan‐
172 nels=stereo.
173
174
175 dat Equivalent to encoding=linear16,rate=48k,chan‐
176 nels=stereo.
177
178
179
180 format This option specifies the audio file format. Valid formats
181 are:
182
183 sun Sun compatible file format (the default).
184
185
186 raw Use this format when reading or writing raw audio
187 data (with no audio header), or in conjunction with
188 an offset to import a foreign audio file format.
189
190
191
192 offset (-i only) Specifies a byte offset to locate the start of
193 the audio data. This option may be used to import audio
194 data that contains an unrecognized file header.
195
196
198 See largefile(5) for the description of the behavior of audioconvert
199 when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
200
202 Example 1 Recording and compressing voice data before storing it
203
204
205 Record voice data and compress it before storing it to a file:
206
207
208 example% audiorecord | audioconvert -f g721 > mydata.au
209
210
211
212 Example 2 Concatenating two audio files
213
214
215 Concatenate two Sun format audio files, regardless of their data for‐
216 mat, and output an 8-bit ulaw, 16 kHz, mono file:
217
218
219 example% audioconvert -f ulaw,rate=16k,mono -o outfile.au infile1 infile2
220
221
222
223 Example 3 Converting a directory to Sun format
224
225
226 Convert a directory containing raw voice data files, in place, to Sun
227 format (adds a file header to each file):
228
229
230 example% audioconvert -p -i voice -f sun *.au
231
232
233
235 See attributes(5) for descriptions of the following attributes:
236
237
238
239
240 ┌─────────────────────────────┬─────────────────────────────┐
241 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
242 ├─────────────────────────────┼─────────────────────────────┤
243 │Architecture │SPARC, x86 │
244 ├─────────────────────────────┼─────────────────────────────┤
245 │Availability │SUNWauda │
246 ├─────────────────────────────┼─────────────────────────────┤
247 │Interface Stability │Evolving │
248 └─────────────────────────────┴─────────────────────────────┘
249
251 audioplay(1), audiorecord(1), file(1), attributes(5), largefile(5)
252
254 The algorithm used for converting multi-channel data to mono is imple‐
255 mented by simply summing the channels together. If the input data is
256 perfectly in phase (as would be the case if a mono file is converted to
257 stereo and back to mono), the resulting data may contain some distor‐
258 tion.
259
260
261
262SunOS 5.11 16 Feb 2001 audioconvert(1)