Annotation of src/usr.bin/aucat/aucat.1, Revision 1.84
1.84 ! ratchov 1: .\" $OpenBSD: aucat.1,v 1.83 2011/06/03 09:01:14 ratchov 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.84 ! ratchov 17: .Dd $Mdocdate: June 3 2011 $
1.1 kstailey 18: .Dt AUCAT 1
1.5 aaron 19: .Os
1.1 kstailey 20: .Sh NAME
21: .Nm aucat
1.47 ratchov 22: .Nd audio server and stream manipulation tool
1.1 kstailey 23: .Sh SYNOPSIS
24: .Nm aucat
1.16 ratchov 25: .Bk -words
1.59 ratchov 26: .Op Fl dlnu
1.70 ratchov 27: .Op Fl a Ar flag
1.49 jmc 28: .Op Fl b Ar nframes
1.16 ratchov 29: .Op Fl C Ar min : Ns Ar max
30: .Op Fl c Ar min : Ns Ar max
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 i Ar file
1.68 ratchov 35: .Op Fl j Ar flag
1.76 ratchov 36: .Op Fl L Ar addr
1.37 ratchov 37: .Op Fl m Ar mode
1.16 ratchov 38: .Op Fl o Ar file
1.66 ratchov 39: .Op Fl q Ar device
1.16 ratchov 40: .Op Fl r Ar rate
1.57 ratchov 41: .Op Fl s Ar name
1.62 ratchov 42: .Op Fl t Ar mode
1.54 ratchov 43: .Op Fl U Ar unit
1.30 ratchov 44: .Op Fl v Ar volume
1.80 ratchov 45: .Op Fl w Ar flag
1.22 ratchov 46: .Op Fl x Ar policy
1.62 ratchov 47: .Op Fl z Ar nframes
1.16 ratchov 48: .Ek
1.1 kstailey 49: .Sh DESCRIPTION
1.9 millert 50: .Nm
1.71 ratchov 51: is an audio utility which can simultaneously play and record
52: any number of audio
53: .Em streams
54: on any number of audio devices,
55: possibly controlled through MIDI.
56: It can also act as an audio server, in which case streams
57: correspond to client connections rather than plain files.
58: .Pp
59: Audio devices are independent.
60: A list of streams is attached to each audio device,
61: as well as an optional list of MIDI ports to control the device.
62: A typical invocation of
63: .Nm
64: consists in providing streams to play and record,
65: and possibly the audio device to use, if the default is not desired.
66: .Pp
67: This also applies to server mode, except that streams are created
68: dynamically when clients connect to the server.
69: Thus, instead of actual streams (paths to plain files),
70: templates for client streams (sub-device names) must be provided.
1.17 jmc 71: .Pp
1.16 ratchov 72: The options are as follows:
1.26 ratchov 73: .Bl -tag -width Ds
1.70 ratchov 74: .It Fl a Ar flag
75: Control whether
76: .Nm
1.71 ratchov 77: opens the audio device only when needed or keeps it open all the time.
1.70 ratchov 78: If the flag is
79: .Va on
80: then the device is kept open all the time, ensuring no other program can
81: steal it.
82: If the flag is
83: .Va off ,
84: then it's automatically closed, allowing other programs to have direct
85: access to the device, or the device to be disconnected.
86: The default is
87: .Va on .
1.49 jmc 88: .It Fl b Ar nframes
1.66 ratchov 89: The buffer size of the audio device in frames.
1.49 jmc 90: A frame consists of one sample for each channel in the stream.
91: This is the number of frames that will be buffered before being played
92: and thus controls the playback latency.
1.25 jmc 93: .It Xo
94: .Fl C Ar min : Ns Ar max ,
95: .Fl c Ar min : Ns Ar max
96: .Xc
1.72 jmc 97: The range of stream channel numbers for recording and playback directions,
98: respectively.
1.17 jmc 99: The default is 0:1, i.e. stereo.
1.59 ratchov 100: .It Fl d
1.71 ratchov 101: Increase log verbosity.
1.59 ratchov 102: .Nm
1.75 okan 103: logs on
104: .Em stderr
105: until it daemonizes.
1.26 ratchov 106: .It Fl e Ar enc
107: Encoding of the playback or recording stream (see below).
1.17 jmc 108: The default is signed, 16-bit, native byte order.
109: .It Fl f Ar device
1.71 ratchov 110: Add this
1.57 ratchov 111: .Xr sndio 7
1.71 ratchov 112: audio device to devices used for playing and/or recording.
113: Preceding streams
114: .Pq Fl ios ,
115: control MIDI ports
116: .Pq Fl q ,
117: and per-device options
1.80 ratchov 118: .Pq Fl abwz
1.71 ratchov 119: apply to this device.
120: Device mode and parameters are determined from streams
121: attached to it.
1.26 ratchov 122: .It Fl h Ar fmt
123: File format of the playback or record stream (see below).
1.17 jmc 124: The default is auto.
1.16 ratchov 125: .It Fl i Ar file
1.71 ratchov 126: Add this file to the list of streams to play.
1.16 ratchov 127: If the option argument is
128: .Sq -
129: then standard input will be used.
1.68 ratchov 130: .It Fl j Ar flag
1.71 ratchov 131: Control whether stream channels are joined or expanded if
1.68 ratchov 132: the stream number of channels is not equal to the device number of channels.
133: If the flag is
134: .Va off
135: then stream channels are routed to the corresponding
136: device channel, possibly discarding channels not present in the device.
137: If the flag is
138: .Va on ,
139: then a single stream channel may be sent on multiple device channels,
140: or multiple stream channels may be sent to a single device channel.
141: For instance, this feature could be used to request mono streams to
142: be sent on multiple outputs or to record a stereo input into a mono stream.
143: The default is
144: .Ar on .
1.76 ratchov 145: .It Fl L Ar addr
146: Specify a local network address to listen on in server mode.
147: .Nm
148: will listen on TCP port 11025+n, where n is the unit number
149: specified with
150: .Fl U .
151: Without this option,
152: .Nm
153: listens on the
154: .Ux Ns -domain
155: socket only, and is not reachable from any network.
1.78 ratchov 156: If the option argument is
157: .Sq -
158: then
159: .Nm
160: will accept connections from any address.
1.26 ratchov 161: .It Fl l
1.71 ratchov 162: Detach and become a daemon.
1.37 ratchov 163: .It Fl m Ar mode
1.66 ratchov 164: Set the stream mode.
1.37 ratchov 165: Valid modes are
1.39 jmc 166: .Ar play ,
167: .Ar rec ,
1.37 ratchov 168: and
1.66 ratchov 169: .Ar mon ,
170: corresponding to playback, recording and monitoring.
171: A monitoring stream is a fake recording stream corresponding to
172: the mix of all playback streams.
173: Multiple modes can be specified, separated by commas,
174: but the same stream cannot be used for both recording and monitoring.
1.37 ratchov 175: The default is
1.67 jmc 176: .Ar play , Ns Ar rec
1.66 ratchov 177: (i.e. full-duplex).
1.42 ratchov 178: .It Fl n
179: Loopback mode.
1.71 ratchov 180: Instead of using audio devices, send input streams
1.42 ratchov 181: to the output, processing them on the fly.
182: This mode is useful to mix, demultiplex, resample or reencode
1.43 jmc 183: audio files offline.
1.16 ratchov 184: .It Fl o Ar file
1.71 ratchov 185: Add this file to the list of recording streams.
1.16 ratchov 186: If the option argument is
187: .Sq -
188: then standard output will be used.
1.66 ratchov 189: .It Fl q Ar device
1.71 ratchov 190: Expose the audio device clock on this
1.66 ratchov 191: .Xr sndio 7
1.71 ratchov 192: MIDI port and allow audio device properties to be controlled
193: through MIDI.
194: This includes per-stream volumes and the ability to
195: synchronously start, stop and relocate streams created in
196: MIDI Machine
197: Control (MMC) slave mode
198: .Pq Fl t .
1.26 ratchov 199: .It Fl r Ar rate
1.71 ratchov 200: Sample rate in Hertz of the stream.
1.17 jmc 201: The default is 44100Hz.
1.57 ratchov 202: .It Fl s Ar name
203: Add
204: .Ar name
205: to the list of sub-devices to expose in server mode.
1.71 ratchov 206: This allows clients to use
207: .Nm
208: instead of the physical audio device for audio input and output
209: in order to share the physical device with other clients.
1.57 ratchov 210: Defining multiple sub-devices allows splitting a physical audio device
1.63 jmc 211: into logical devices having different properties (e.g. channel ranges).
1.57 ratchov 212: The given
213: .Ar name
1.62 ratchov 214: corresponds to the
1.57 ratchov 215: .Dq option
216: part of the
217: .Xr sndio 7
218: device name string.
1.62 ratchov 219: .It Fl t Ar mode
1.71 ratchov 220: Select the way streams are controlled by MIDI Machine Control (MMC)
1.67 jmc 221: messages.
1.62 ratchov 222: If the mode is
223: .Va off
224: (the default), then streams are not affected by MMC messages.
225: If the mode is
226: .Va slave ,
227: then streams are started synchronously by MMC start messages;
1.67 jmc 228: additionally, the server clock is exposed as MIDI Time Code (MTC)
1.62 ratchov 229: messages allowing MTC-capable software or hardware to be synchronized
230: to audio streams.
1.54 ratchov 231: .It Fl U Ar unit
232: Unit number to use when running in server mode.
233: Each
234: .Nm
235: server instance has an unique unit number,
236: used in
237: .Xr sndio 7
238: device names.
239: The default is 0.
1.16 ratchov 240: .It Fl u
1.21 jmc 241: Normally
242: .Nm
243: tries to automatically determine the optimal parameters for the audio device;
244: if this option is specified,
245: it will instead use the parameters specified by the
1.26 ratchov 246: .Fl Ccer
1.21 jmc 247: options.
1.30 ratchov 248: .It Fl v Ar volume
249: Software volume attenuation of the playback stream.
250: The value must be between 1 and 127,
1.82 jmc 251: corresponding to \-42dB and \-0dB attenuation in 1/3dB steps.
1.33 ratchov 252: In server mode, clients inherit this parameter.
1.82 jmc 253: Reducing the volume in advance allows a client's volume to stay independent
1.81 ratchov 254: from the number of clients as long as their number is small enough.
1.82 jmc 255: 18 volume units (i.e. \-6dB attenuation) allows the number
1.81 ratchov 256: of playback streams to be doubled.
1.82 jmc 257: The default is 127 i.e. no attenuation.
1.80 ratchov 258: .It Fl w Ar flag
259: Control
260: .Nm
261: behaviour when the maximum volume of the hardware is reached
262: and a new stream is connected.
263: This happens only when stream volumes
264: are not properly set using the
265: .Fl v
266: option.
267: If the flag is
268: .Va on ,
269: then the master volume (corresponding to the mix of all playback streams)
270: is automatically adjusted to avoid clipping.
271: Using
1.82 jmc 272: .Va off
1.80 ratchov 273: makes sense when all streams are recorded or produced with properly lowered
274: volumes.
275: The default is
276: .Va on .
1.26 ratchov 277: .It Fl x Ar policy
1.22 ratchov 278: Action when the output stream cannot accept
1.26 ratchov 279: recorded data fast enough or the input stream
280: cannot provide data to play fast enough.
1.22 ratchov 281: If the policy
282: is
1.23 jmc 283: .Dq ignore
1.26 ratchov 284: (the default) then samples that cannot be written are discarded
285: and samples that cannot be read are replaced by silence.
1.22 ratchov 286: If the policy is
1.23 jmc 287: .Dq sync
1.72 jmc 288: then recorded samples are discarded,
289: but the same amount of silence will be written
1.22 ratchov 290: once the stream is unblocked, in order to reach the right position in time.
1.26 ratchov 291: Similarly silence is played, but the same amount of samples will be discarded
292: once the stream is unblocked.
1.22 ratchov 293: If the policy is
1.23 jmc 294: .Dq error
295: then the stream is closed permanently.
1.62 ratchov 296: .Pp
1.71 ratchov 297: If a stream is created with the
1.67 jmc 298: .Fl t
299: option,
1.63 jmc 300: the
1.62 ratchov 301: .Dq ignore
1.63 jmc 302: action is disabled for any stream connected to it
303: to ensure proper synchronization.
1.62 ratchov 304: .It Fl z Ar nframes
1.71 ratchov 305: The audio device block size in frames.
1.63 jmc 306: This is the number of frames between audio clock ticks,
307: i.e. the clock resolution.
1.71 ratchov 308: If a stream is created with the
1.67 jmc 309: .Fl t
310: option,
311: and MTC is used for synchronization, the clock
1.62 ratchov 312: resolution must be 96, 100 or 120 ticks per second for maximum
1.63 jmc 313: accuracy.
314: For instance, 120 ticks per second at 48000Hz corresponds
315: to a 400 frame block size.
1.21 jmc 316: .El
317: .Pp
1.71 ratchov 318: On the command line,
319: per-device parameters
1.80 ratchov 320: .Pq Fl abwz
1.71 ratchov 321: must precede the device definition
322: .Pq Fl f ,
323: and per-stream parameters
324: .Pq Fl Ccehjmrtvx
325: must precede the stream definition
326: .Pq Fl ios .
327: MIDI ports
328: .Pq Fl q
1.75 okan 329: and stream definitions
1.71 ratchov 330: .Pq Fl ios
331: must precede the definition of the device
332: .Pq Fl f
333: to which they are attached.
334: Global parameters
1.74 ratchov 335: .Pq Fl dlnUu
1.71 ratchov 336: are position-independent.
337: .Pp
338: If no audio devices
339: .Pq Fl f
340: are specified,
341: settings are applied as if
342: the default device is specified as the last argument.
343: If no streams
344: .Pq Fl ios
345: are specified for a device, a default server sub-device is
346: created attached to it, meaning that
347: .Nm
348: behaves as an audio server.
349: The default
350: .Xr sndio 7
351: device is
352: .Pa aucat:0
353: .Pq also known as Pa aucat:0.default
354: .Pp
1.32 ratchov 355: If
356: .Nm
357: is sent
1.44 ratchov 358: .Dv SIGHUP ,
359: .Dv SIGINT
360: or
361: .Dv SIGTERM ,
1.32 ratchov 362: it terminates recording to files.
363: .Pp
1.20 jmc 364: File formats are specified using the
365: .Fl h
1.26 ratchov 366: option.
1.16 ratchov 367: The following file formats are supported:
1.66 ratchov 368: .Bl -tag -width s32lexxx -offset indent
1.16 ratchov 369: .It raw
370: Headerless file.
1.17 jmc 371: This format is recommended since it has no limitations.
1.16 ratchov 372: .It wav
373: Microsoft WAVE file format.
374: There are limitations inherent to the file format itself:
375: not all encodings are supported,
376: file sizes are limited to 2GB,
1.17 jmc 377: and the file must support the
1.16 ratchov 378: .Xr lseek 2
1.17 jmc 379: operation (e.g. pipes do not support it).
1.16 ratchov 380: .It auto
381: Try to guess, depending on the file name.
1.9 millert 382: .El
383: .Pp
1.20 jmc 384: Encodings are specified using the
385: .Fl e
1.26 ratchov 386: option.
1.16 ratchov 387: The following encodings are supported:
388: .Pp
1.66 ratchov 389: .Bl -tag -width s32lexxx -offset indent -compact
1.16 ratchov 390: .It s8
391: signed 8-bit
392: .It u8
393: unsigned 8-bit
394: .It s16le
395: signed 16-bit, little endian
396: .It u16le
397: unsigned 16-bit, little endian
398: .It s16be
399: signed 16-bit, big endian
400: .It u16be
401: unsigned 16-bit, big endian
402: .It s24le
403: signed 24-bit, stored in 4 bytes, little endian
404: .It u24le
405: unsigned 24-bit, stored in 4 bytes, little endian
406: .It s24be
407: signed 24-bit, stored in 4 bytes, big endian
408: .It u24be
409: unsigned 24-bit, stored in 4 bytes, big endian
410: .It s32le
411: signed 32-bit, little endian
412: .It u32le
413: unsigned 32-bit, little endian
414: .It s32be
415: signed 32-bit, big endian
416: .It u32be
417: unsigned 32-bit, big endian
418: .It s24le3
419: signed 24-bit, packed in 3 bytes, little endian
420: .It u24le3
421: unsigned 24-bit, packed in 3 bytes, big endian
422: .It s24be3
423: signed 24-bit, packed in 3 bytes, little endian
424: .It u24be3
425: unsigned 24-bit, packed in 3 bytes, big endian
426: .It s20le3
427: signed 20-bit, packed in 3 bytes, little endian
428: .It u20le3
429: unsigned 20-bit, packed in 3 bytes, big endian
430: .It s20be3
431: signed 20-bit, packed in 3 bytes, little endian
432: .It u20be3
433: unsigned 20-bit, packed in 3 bytes, big endian
434: .It s18le3
435: signed 18-bit, packed in 3 bytes, little endian
436: .It u18le3
437: unsigned 18-bit, packed in 3 bytes, big endian
438: .It s18be3
439: signed 18-bit, packed in 3 bytes, little endian
440: .It u18be3
441: unsigned 18-bit, packed in 3 bytes, big endian
442: .El
1.46 ratchov 443: .Sh SERVER MODE
1.71 ratchov 444: If at least one sub-device
445: .Pq Fl s
446: is exposed by
447: .Nm ,
448: including the case when no stream options are given,
449: then
1.46 ratchov 450: .Nm
1.71 ratchov 451: can be used as a server
1.46 ratchov 452: to overcome hardware limitations and allow applications
453: to run on fixed sample rate devices or on devices
454: supporting only unusual encodings.
1.69 ratchov 455: .Pp
1.46 ratchov 456: Certain applications, such as synthesis software,
457: require a low latency audio setup.
1.71 ratchov 458: To reduce the probability of buffer underruns or overruns, especially
459: on busy machines, the server can be started by the super-user, in which
460: case it will run with higher priority.
1.72 jmc 461: Any user will still be able to connect to it,
462: but for privacy reasons only one user may have
1.71 ratchov 463: connections to it at a given time.
1.55 ratchov 464: .Sh MIDI CONTROL
465: .Nm
1.71 ratchov 466: can expose the audio device clock on registered
467: MIDI ports
468: .Pq Fl q
469: and allows audio device properties to be controlled
470: through MIDI.
471: If running in server mode
1.62 ratchov 472: .Nm
1.71 ratchov 473: creates a MIDI port with the same name as the default audio
474: device to which MIDI programs can connect.
1.62 ratchov 475: .Pp
1.56 jmc 476: A MIDI channel is assigned to each stream, and the volume
1.55 ratchov 477: is changed using the standard volume controller (number 7).
1.71 ratchov 478: Similarly, when the audio client changes its volume,
1.55 ratchov 479: the same MIDI controller message is sent out; it can be used
1.56 jmc 480: for instance for monitoring or as feedback for motorized
1.55 ratchov 481: faders.
1.62 ratchov 482: .Pp
1.71 ratchov 483: Streams created with the
1.63 jmc 484: .Fl t
1.67 jmc 485: option are controlled by the following MMC messages:
1.66 ratchov 486: .Bl -tag -width relocateXXX -offset indent
1.62 ratchov 487: .It relocate
1.79 jmc 488: Streams are relocated to the requested time position
1.71 ratchov 489: relative to the beginning of the stream, at which playback
1.62 ratchov 490: and recording must start.
1.71 ratchov 491: If the requested position is beyond the end of file,
1.79 jmc 492: the stream is temporarly disabled until a valid position is requested.
1.71 ratchov 493: This message is ignored by client streams (server mode).
494: The given time position is sent to MIDI ports as an MTC
1.62 ratchov 495: .Dq "full frame"
496: message forcing all MTC-slaves to relocate to the given
497: position (see below).
498: .It start
1.71 ratchov 499: Put all streams in starting mode.
500: In this mode,
501: .Nm
502: waits for all streams to become ready
1.62 ratchov 503: to start, and then starts them synchronously.
1.72 jmc 504: Once started, new streams can be created (server mode)
505: but they will be blocked
1.62 ratchov 506: until the next stop-to-start transition.
1.67 jmc 507: .It stop
1.71 ratchov 508: Put all streams in stopped mode (the default).
1.67 jmc 509: In this mode, any stream attempting to start playback or recording
510: is paused.
1.71 ratchov 511: Files are stopped and rewound back to the starting position,
512: while client streams (server mode) that are already
513: started are not affected until they stop and try to start again.
1.62 ratchov 514: .El
515: .Pp
1.71 ratchov 516: Streams created with the
1.63 jmc 517: .Fl t
1.67 jmc 518: option export the server clock using MTC, allowing non-audio
1.62 ratchov 519: software or hardware to be synchronized to the audio stream.
1.84 ! ratchov 520: Maximum accuracy is achieved when the number of blocks per
! 521: second is equal to one of the standard MTC clock rates (96, 100 and 120Hz).
1.62 ratchov 522: The following sample rates
523: .Pq Fl r
524: and block sizes
525: .Pq Fl z
1.84 ! ratchov 526: are recommended:
1.62 ratchov 527: .Pp
1.66 ratchov 528: .Bl -bullet -offset indent -compact
1.62 ratchov 529: .It
1.84 ! ratchov 530: 44100Hz, 441 frames (MTC rate is 100Hz)
1.62 ratchov 531: .It
1.84 ! ratchov 532: 48000Hz, 400 frames (MTC rate is 120Hz)
1.62 ratchov 533: .It
1.84 ! ratchov 534: 48000Hz, 480 frames (MTC rate is 100Hz)
1.62 ratchov 535: .It
1.84 ! ratchov 536: 48000Hz, 500 frames (MTC rate is 96Hz)
1.62 ratchov 537: .El
538: .Pp
539: For instance, the following command will create two devices:
540: the default
541: .Va aucat:0
1.63 jmc 542: and a MIDI-controlled
543: .Va aucat:0.mmc :
1.62 ratchov 544: .Bd -literal -offset indent
545: $ aucat -l -r 48000 -z 400 -s default -t slave -s mmc
546: .Ed
547: .Pp
548: Streams connected to
549: .Va aucat:0
550: behave normally, while streams connected to
551: .Va aucat:0.mmc
552: wait for the MMC start signal and start synchronously.
1.63 jmc 553: Regardless of which device a stream is connected to,
554: its playback volume knob is exposed.
1.66 ratchov 555: .Pp
556: For instance, the following command will play a file on the
557: .Va aucat:0.mmc
558: audio device, and give full control to MIDI software or hardware
559: connected to the
560: .Va midithru:0
561: MIDI device:
562: .Bd -literal -offset indent
1.70 ratchov 563: $ aucat -t slave -q midithru:0 -i file.wav -f aucat:0.mmc
1.66 ratchov 564: .Ed
565: .Pp
566: At this stage,
567: .Nm
568: will start, stop and relocate automatically following all user
569: actions in the MIDI sequencer.
570: Note that the sequencer must use
571: .Va aucat:0
572: as the MTC source, i.e. the audio server, not the audio player.
1.9 millert 573: .Sh ENVIRONMENT
1.76 ratchov 574: .Bl -tag -width "AUCAT_COOKIE" -compact
575: .It Ev AUCAT_COOKIE
1.77 jmc 576: File containing user's session cookie.
1.24 jmc 577: .It Ev AUDIODEVICE
1.57 ratchov 578: .Xr sndio 7
579: audio device to use if the
1.50 ratchov 580: .Fl f
581: option is not specified.
1.9 millert 582: .El
1.16 ratchov 583: .Sh EXAMPLES
1.77 jmc 584: Mix and play two stereo streams,
1.16 ratchov 585: the first at 48kHz and the second at 44.1kHz:
586: .Bd -literal -offset indent
587: $ aucat -r 48000 -i file1.raw -r 44100 -i file2.raw
588: .Ed
589: .Pp
1.77 jmc 590: Record channels 2 and 3 into one stereo file and
1.16 ratchov 591: channels 6 and 7 into another stereo file using a 96kHz sampling rate for
592: both:
593: .Bd -literal -offset indent
1.83 ratchov 594: $ aucat -j off -r 96000 -C 2:3 -o file1.raw -C 6:7 -o file2.raw
1.42 ratchov 595: .Ed
596: .Pp
1.77 jmc 597: Split a stereo file into two mono files:
1.42 ratchov 598: .Bd -literal -offset indent
1.83 ratchov 599: $ aucat -n -j off -i stereo.wav -C 0:0 -o left.wav -C 1:1 -o right.wav
1.16 ratchov 600: .Ed
601: .Pp
1.77 jmc 602: Start
1.35 ratchov 603: .Nm
1.77 jmc 604: in server mode using default parameters, creating an
1.57 ratchov 605: additional sub-device for output to channels 2:3 only (rear speakers
606: on most cards), exposing the
607: .Pa aucat:0
608: and
609: .Pa aucat:0.rear
610: devices:
1.35 ratchov 611: .Bd -literal -offset indent
1.45 ratchov 612: $ aucat -l -s default -c 2:3 -s rear
1.35 ratchov 613: .Ed
614: .Pp
1.77 jmc 615: Start
1.35 ratchov 616: .Nm
1.77 jmc 617: in server mode, creating the default sub-device with low volume and
1.57 ratchov 618: an additional sub-device for high volume output, exposing the
619: .Pa aucat:0
620: and
621: .Pa aucat:0.max
622: devices:
1.35 ratchov 623: .Bd -literal -offset indent
1.45 ratchov 624: $ aucat -l -v 65 -s default -v 127 -s max
1.16 ratchov 625: .Ed
1.71 ratchov 626: .Pp
1.77 jmc 627: Start
1.71 ratchov 628: .Nm
1.77 jmc 629: in server mode, configuring the audio device to use
1.72 jmc 630: a 48kHz sample frequency, 240-frame block size,
631: and 2-block buffers.
1.71 ratchov 632: The corresponding latency is 10ms, which is
633: the time it takes the sound to propagate 3.5 meters.
634: .Bd -literal -offset indent
635: $ aucat -l -r 48000 -b 480 -z 240
636: .Ed
1.2 kstailey 637: .Sh SEE ALSO
1.12 jmc 638: .Xr audioctl 1 ,
1.17 jmc 639: .Xr cdio 1 ,
1.9 millert 640: .Xr mixerctl 1 ,
1.54 ratchov 641: .Xr audio 4 ,
642: .Xr sndio 7
1.16 ratchov 643: .Sh BUGS
644: The
1.1 kstailey 645: .Nm
1.16 ratchov 646: utility assumes non-blocking I/O for input and output streams.
647: It will not work reliably on files that may block
648: (ordinary files block, pipes don't).
1.71 ratchov 649: To avoid audio underruns/overruns or MIDI jitter caused by file I/O,
650: it's recommended to use two
651: .Nm
652: processes: a server handling audio and MIDI I/O and a client handling
653: disk I/O.
1.16 ratchov 654: .Pp
655: Resampling is low quality; down-sampling especially should be avoided
656: when recording.
657: .Pp
658: Processing is done using 16-bit arithmetic,
659: thus samples with more than 16 bits are rounded.
1.17 jmc 660: 16 bits (i.e. 97dB dynamic) are largely enough for most applications though.
1.71 ratchov 661: .Pp
662: If
663: .Fl a Ar off
1.72 jmc 664: is used in server mode,
1.71 ratchov 665: .Nm
1.72 jmc 666: creates sub-devices to expose first
667: and then opens the audio hardware on demand.
1.71 ratchov 668: Technically, this allows
669: .Nm
1.75 okan 670: to attempt to use one of the sub-devices it exposes as an audio device,
1.71 ratchov 671: creating a deadlock.
672: To avoid this,
673: .Fl a Ar off
674: is disabled for the default audio device, but nothing prevents the user
675: from shooting himself in the foot by creating a similar deadlock.