Annotation of src/usr.bin/aucat/aucat.1, Revision 1.18
1.18 ! jakemsr 1: .\" $OpenBSD: aucat.1,v 1.17 2008/05/23 12:56:27 jmc Exp $
1.1 kstailey 2: .\"
1.16 ratchov 3: .\" Copyright (c) 2006 Alexandre Ratchov <alex@caoua.org>
1.1 kstailey 4: .\"
1.16 ratchov 5: .\" Permission to use, copy, modify, and distribute this software for any
6: .\" purpose with or without fee is hereby granted, provided that the above
7: .\" copyright notice and this permission notice appear in all copies.
1.1 kstailey 8: .\"
1.16 ratchov 9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 kstailey 16: .\"
1.17 jmc 17: .Dd $Mdocdate: May 23 2008 $
1.1 kstailey 18: .Dt AUCAT 1
1.5 aaron 19: .Os
1.1 kstailey 20: .Sh NAME
21: .Nm aucat
1.16 ratchov 22: .Nd manipulate linear audio streams
1.1 kstailey 23: .Sh SYNOPSIS
24: .Nm aucat
1.16 ratchov 25: .Bk -words
1.18 ! jakemsr 26: .Op Fl uq
1.16 ratchov 27: .Op Fl C Ar min : Ns Ar max
28: .Op Fl c Ar min : Ns Ar max
29: .Op Fl d Ar level
30: .Op Fl E Ar enc
31: .Op Fl e Ar enc
1.9 millert 32: .Op Fl f Ar device
1.16 ratchov 33: .Op Fl H Ar fmt
34: .Op Fl h Ar fmt
35: .Op Fl i Ar file
36: .Op Fl o Ar file
37: .Op Fl R Ar rate
38: .Op Fl r Ar rate
39: .Ek
1.1 kstailey 40: .Sh DESCRIPTION
41: The
1.7 aaron 42: .Nm
1.16 ratchov 43: utility can record one input stream
44: and store it on multiple destination files,
45: doing the necessary conversions on the fly.
1.17 jmc 46: It can play, convert, and mix multiple input files simultaneously.
1.9 millert 47: .Nm
1.16 ratchov 48: also has a legacy mode that works like previous versions of
49: .Nm ,
50: which does not convert on the fly and supports playback of .au files.
1.17 jmc 51: .Pp
1.16 ratchov 52: The options are as follows:
53: .Bl -tag -width "-m mmmmmmmm "
54: .It Fl C Ar min : Ns Ar max
1.17 jmc 55: The range of channel numbers on the output stream.
56: The default is 0:1, i.e. stereo.
1.16 ratchov 57: .It Fl c Ar min : Ns Ar max
1.17 jmc 58: The range of channel numbers on the input stream.
59: The default is 0:1, i.e. stereo.
1.16 ratchov 60: .It Fl d Ar level
61: The debug level:
62: may be a value between 0 and 4.
63: .It Fl E Ar enc
1.17 jmc 64: Encoding of the output stream.
65: The default is signed, 16-bit, native byte order.
1.16 ratchov 66: .It Fl e Ar enc
1.17 jmc 67: Encoding of the input stream.
68: The default is signed, 16-bit, native byte order.
69: .It Fl f Ar device
70: The
71: .Xr audio 4
72: device to use for playing and/or recording.
73: The default is
74: .Pa /dev/audio .
1.16 ratchov 75: .It Fl H Ar fmt
1.17 jmc 76: File format of the output stream (see below).
77: The default is auto.
1.16 ratchov 78: .It Fl h Ar fmt
1.17 jmc 79: File format of the input stream (see below).
80: The default is auto.
1.16 ratchov 81: .It Fl i Ar file
82: Add this file to the list of files to play.
83: The format of the file is specified by the last
1.17 jmc 84: .Fl c ,
1.16 ratchov 85: .Fl e ,
1.17 jmc 86: .Fl h ,
1.16 ratchov 87: and
88: .Fl r
89: options.
90: If the option argument is
91: .Sq -
92: then standard input will be used.
93: .It Fl o Ar file
94: Add this file to the list of files in which to store recorded samples.
95: The format of the file is specified by the last
1.17 jmc 96: .Fl C ,
1.16 ratchov 97: .Fl E ,
1.17 jmc 98: .Fl H ,
1.16 ratchov 99: and
100: .Fl R
101: options.
102: If the option argument is
103: .Sq -
104: then standard output will be used.
105: .It Fl R Ar rate
1.17 jmc 106: Sample rate in Hertz of the output stream.
107: The default is 44100Hz.
1.16 ratchov 108: .It Fl r Ar rate
1.17 jmc 109: Sample rate in Hertz of the input stream.
110: The default is 44100Hz.
1.18 ! jakemsr 111: .It Fl q
! 112: Do not print progress information; run quietly.
1.16 ratchov 113: .It Fl u
114: Don't try to automatically determine the optimal parameters for the
115: audio device;
116: instead use the parameters specified by the last
1.17 jmc 117: .Fl C ,
118: .Fl c ,
1.16 ratchov 119: .Fl E ,
1.17 jmc 120: .Fl e ,
121: .Fl H ,
122: .Fl h ,
1.16 ratchov 123: .Fl R ,
124: and
125: .Fl r
126: options.
1.17 jmc 127: For the
1.16 ratchov 128: .Fl i
129: and
130: .Fl o
1.17 jmc 131: options, if
1.16 ratchov 132: .Fl f
1.17 jmc 133: is used then parameters must be specified before it.
1.16 ratchov 134: .El
1.14 jmc 135: .Pp
1.16 ratchov 136: The following file formats are supported:
137: .Bl -tag -width s32lexxx -offset -indent
138: .It raw
139: Headerless file.
1.17 jmc 140: This format is recommended since it has no limitations.
1.16 ratchov 141: .It wav
142: Microsoft WAVE file format.
143: There are limitations inherent to the file format itself:
144: not all encodings are supported,
145: file sizes are limited to 2GB,
1.17 jmc 146: and the file must support the
1.16 ratchov 147: .Xr lseek 2
1.17 jmc 148: operation (e.g. pipes do not support it).
1.16 ratchov 149: .It auto
150: Try to guess, depending on the file name.
1.9 millert 151: .El
152: .Pp
1.16 ratchov 153: The following encodings are supported:
154: .Pp
155: .Bl -tag -width s32lexxx -offset -indent -compact
156: .It s8
157: signed 8-bit
158: .It u8
159: unsigned 8-bit
160: .It s16le
161: signed 16-bit, little endian
162: .It u16le
163: unsigned 16-bit, little endian
164: .It s16be
165: signed 16-bit, big endian
166: .It u16be
167: unsigned 16-bit, big endian
168: .It s24le
169: signed 24-bit, stored in 4 bytes, little endian
170: .It u24le
171: unsigned 24-bit, stored in 4 bytes, little endian
172: .It s24be
173: signed 24-bit, stored in 4 bytes, big endian
174: .It u24be
175: unsigned 24-bit, stored in 4 bytes, big endian
176: .It s32le
177: signed 32-bit, little endian
178: .It u32le
179: unsigned 32-bit, little endian
180: .It s32be
181: signed 32-bit, big endian
182: .It u32be
183: unsigned 32-bit, big endian
184: .It s24le3
185: signed 24-bit, packed in 3 bytes, little endian
186: .It u24le3
187: unsigned 24-bit, packed in 3 bytes, big endian
188: .It s24be3
189: signed 24-bit, packed in 3 bytes, little endian
190: .It u24be3
191: unsigned 24-bit, packed in 3 bytes, big endian
192: .It s20le3
193: signed 20-bit, packed in 3 bytes, little endian
194: .It u20le3
195: unsigned 20-bit, packed in 3 bytes, big endian
196: .It s20be3
197: signed 20-bit, packed in 3 bytes, little endian
198: .It u20be3
199: unsigned 20-bit, packed in 3 bytes, big endian
200: .It s18le3
201: signed 18-bit, packed in 3 bytes, little endian
202: .It u18le3
203: unsigned 18-bit, packed in 3 bytes, big endian
204: .It s18be3
205: signed 18-bit, packed in 3 bytes, little endian
206: .It u18be3
207: unsigned 18-bit, packed in 3 bytes, big endian
208: .El
209: .Sh LEGACY MODE
210: If neither
211: .Fl i
212: nor
213: .Fl o
1.17 jmc 214: are specified,
1.16 ratchov 215: .Nm
1.17 jmc 216: will run in legacy mode, and won't convert sample formats or sampling rates.
1.16 ratchov 217: In legacy mode, all options except
1.17 jmc 218: .Fl f
219: are ignored, and all other arguments are assumed to be names of files.
1.16 ratchov 220: In legacy mode
221: .Nm
222: reads files sequentially, and writes them to the specified device.
223: If a Sun .au header is detected it is skipped over and not copied to
224: the audio device.
225: .Nm
226: will attempt to play data from Sun .au files as monaural 8-bit ulaw
227: samples with a sampling frequency of 8000 Hz.
228: However,
229: .Nm
230: will not fail if the audio device cannot be configured for these
231: parameters.
232: If a Microsoft .wav header (RIFF) is detected it is interpreted
233: to select the right audio encoding for playback and the data chunk of the
234: file is copied to the audio device.
235: If the device does not support the encoding,
236: .Nm
237: will exit with an error.
1.9 millert 238: .Sh ENVIRONMENT
239: .Bl -tag -width AUDIODEVICE
240: .It Ev AUDIODEVICE
241: The audio device to use.
242: .El
1.16 ratchov 243: .Sh EXAMPLES
244: The following command will record a stereo s16le stream at
245: 44100Hz from the default device.
1.17 jmc 246: If necessary, the stream will be converted and/or resampled
1.16 ratchov 247: to match parameters supported by the device:
248: .Bd -literal -offset indent
249: $ aucat -o file.raw
250: .Ed
251: .Pp
252: The following command will play a stereo s16le stream at
253: 44100Hz on the default device, doing any necessary conversions:
254: .Bd -literal -offset indent
255: $ aucat -i file.raw
256: .Ed
257: .Pp
258: The following will mix and play two stereo streams,
259: the first at 48kHz and the second at 44.1kHz:
260: .Bd -literal -offset indent
261: $ aucat -r 48000 -i file1.raw -r 44100 -i file2.raw
262: .Ed
263: .Pp
264: The following will record channels 2 and 3 into one stereo file and
265: channels 6 and 7 into another stereo file using a 96kHz sampling rate for
266: both:
267: .Bd -literal -offset indent
268: $ aucat -R 96000 -C 2:3 -o file1.raw -C 6:7 -o file2.raw
269: .Ed
270: .Pp
271: The following will play two s18le mono files, one on each channel:
272: .Bd -literal -offset indent
273: $ aucat -e s18le -c 0:0 -i f1.raw -c 1:1 -i f2.raw
274: .Ed
275: .Pp
276: The following will mix and play two files and record a third one in
277: full-duplex:
278: .Bd -literal -offset indent
279: $ aucat -i drums.raw -i bass.raw -o guitar.raw
280: .Ed
1.2 kstailey 281: .Sh SEE ALSO
1.12 jmc 282: .Xr audioctl 1 ,
1.17 jmc 283: .Xr cdio 1 ,
1.9 millert 284: .Xr mixerctl 1 ,
1.2 kstailey 285: .Xr audio 4
1.16 ratchov 286: .Sh BUGS
287: The
1.1 kstailey 288: .Nm
1.16 ratchov 289: utility assumes non-blocking I/O for input and output streams.
290: It will not work reliably on files that may block
291: (ordinary files block, pipes don't).
292: .Pp
293: Resampling is low quality; down-sampling especially should be avoided
294: when recording.
295: .Pp
296: CPU usage is the same for all conversions.
297: It should be smaller for simpler ones.
298: .Pp
299: Buffer overruns and underruns are not handled.
300: .Pp
301: Processing is done using 16-bit arithmetic,
302: thus samples with more than 16 bits are rounded.
1.17 jmc 303: 16 bits (i.e. 97dB dynamic) are largely enough for most applications though.