1 AUDIOCONVERT(1) User Commands AUDIOCONVERT(1) 2 3 4 5 NAME 6 audioconvert - convert audio file formats 7 8 SYNOPSIS 9 audioconvert [-pF] [-f outfmt] [-o outfile] 10 [ [-i infmt] [file]...] ... 11 12 13 DESCRIPTION 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 u-law and linear PCM. 18 19 20 If no filenames are present, audioconvert reads the data from the 21 standard input stream and writes an audio file to the standard output. 22 Otherwise, input files are processed in order, concatenated, and 23 written 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 28 recognizable header, the format must be specified with the -i option, 29 using the rate, encoding, and channels keywords to identify the input 30 data format. 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 36 resulting format and concatenated together. The output file will 37 contain an audio file header, unless format=raw is specified in the 38 output format 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 50 OPTIONS 51 The following options are supported: 52 53 -p 54 In Place: The input files are individually converted to 55 the format specified by the -f option and rewritten. If a 56 target file is a symbolic link, the underlying file will 57 be rewritten. The -o option may not be specified with -p. 58 59 60 -F 61 Force: This option forces audioconvert to ignore any file 62 header for input files whose format is specified by the 63 -i option. If -F is not specified, audioconvert ignores 64 the -i option for input files that contain valid audio 65 file headers. 66 67 68 -f outfmt 69 Output Format: This option is used to specify the file 70 format and data encoding of the output file. Defaults for 71 unspecified fields are derived from the input file 72 format. Valid keywords and values are listed in the next 73 section. 74 75 76 -o outfile 77 Output File: All input files are concatenated, converted 78 to the output format, and written to the named output 79 file. If -o and -p are not specified, the concatenated 80 output is written to the standard output. The -p option 81 may not be specified with -o. 82 83 84 -i infmt 85 Input Format: This option is used to specify the data 86 encoding of raw input files. Ordinarily, the input data 87 format is derived from the audio file header. This option 88 is required when converting audio data that is not 89 preceded by a valid audio file header. If -i is specified 90 for an input file that contains an audio file header, the 91 input format string will be ignored, unless -F is 92 present. The format specification syntax is the same as 93 the -f output file format. 94 95 Multiple input formats may be specified. An input format 96 describes all input files following that specification, 97 until a new input format is specified. 98 99 100 file 101 File Specification: The named audio files are 102 concatenated, converted to the output format, and written 103 out. If no file name is present, or if the special file 104 name `-' is specified, audio data is read from the 105 standard input. 106 107 108 -? 109 Help: Prints a command line usage message. 110 111 112 Format Specification 113 The syntax for the input and output format specification is: 114 115 116 keyword=value[,keyword=value ...] 117 118 119 with no intervening whitespace. Unambiguous values may be used without 120 the preceding keyword=. 121 122 rate 123 The audio sampling rate is specified in samples per second. 124 If a number is followed by the letter k, it is multiplied 125 by 1000 (for example, 44.1k = 44100). Standard of the 126 commonly used sample rates are: 8k, 16k, 32k, 44.1k, and 127 48k. 128 129 130 channels 131 The number of interleaved channels is specified as an 132 integer. The words mono and stereo may also be used to 133 specify one and two channel data, respectively. 134 135 136 encoding 137 This option specifies the digital audio data 138 representation. Encodings determine precision implicitly 139 (ulaw implies 8-bit precision) or explicitly as part of the 140 name (for example, linear16). Valid encoding values are: 141 142 ulaw 143 CCITT G.711 u-law encoding. This is an 8-bit 144 format primarily used for telephone quality 145 speech. 146 147 148 alaw 149 CCITT G.711 A-law encoding. This is an 8-bit 150 format primarily used for telephone quality 151 speech in Europe. 152 153 154 linear8, 155 linear16, 156 linear32 157 Linear Pulse Code Modulation (PCM) encoding. 158 The name identifies the number of bits of 159 precision. linear16 is typically used for high 160 quality audio data. 161 162 163 pcm 164 Same as linear16. 165 166 167 g721 168 CCITT G.721 compression format. This encoding 169 uses Adaptive Delta Pulse Code Modulation 170 (ADPCM) with 4-bit precision. It is primarily 171 used for compressing u-law voice data 172 (achieving a 2:1 compression ratio). 173 174 175 g723 176 CCITT G.723 compression format. This encoding 177 uses Adaptive Delta Pulse Code Modulation 178 (ADPCM) with 3-bit precision. It is primarily 179 used for compressing u-law voice data 180 (achieving an 8:3 compression ratio). The 181 audio quality is similar to G.721, but may 182 result in lower quality when used for non- 183 speech data. 184 185 The following encoding values are also accepted as 186 shorthand to set the sample rate, channels, and encoding: 187 188 voice 189 Equivalent to encoding=ulaw,rate=8k,channels=mono. 190 191 192 cd 193 Equivalent to 194 encoding=linear16,rate=44.1k,channels=stereo. 195 196 197 dat 198 Equivalent to 199 encoding=linear16,rate=48k,channels=stereo. 200 201 202 203 format 204 This option specifies the audio file format. Valid formats 205 are: 206 207 sun 208 Sun compatible file format (the default). 209 210 211 raw 212 Use this format when reading or writing raw audio 213 data (with no audio header), or in conjunction with 214 an offset to import a foreign audio file format. 215 216 217 218 offset 219 (-i only) Specifies a byte offset to locate the start of 220 the audio data. This option may be used to import audio 221 data that contains an unrecognized file header. 222 223 224 USAGE 225 See largefile(5) for the description of the behavior of audioconvert 226 when encountering files greater than or equal to 2 Gbyte (2^31 bytes). 227 228 EXAMPLES 229 Example 1 Recording and compressing voice data before storing it 230 231 232 Record voice data and compress it before storing it to a file: 233 234 235 example% audiorecord | audioconvert -f g721 > mydata.au 236 237 238 239 Example 2 Concatenating two audio files 240 241 242 Concatenate two Sun format audio files, regardless of their data 243 format, and output an 8-bit ulaw, 16 kHz, mono file: 244 245 246 example% audioconvert -f ulaw,rate=16k,mono -o outfile.au infile1 infile2 247 248 249 250 Example 3 Converting a directory to Sun format 251 252 253 Convert a directory containing raw voice data files, in place, to Sun 254 format (adds a file header to each file): 255 256 257 example% audioconvert -p -i voice -f sun *.au 258 259 260 261 SEE ALSO 262 audioplay(1), audiorecord(1), file(1), largefile(5) 263 264 NOTES 265 The algorithm used for converting multi-channel data to mono is 266 implemented by simply summing the channels together. If the input data 267 is perfectly in phase (as would be the case if a mono file is converted 268 to stereo and back to mono), the resulting data may contain some 269 distortion. 270 271 272 273 February 8, 2020 AUDIOCONVERT(1)