[BACK]Return to aucat.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / aucat

Annotation of src/usr.bin/aucat/aucat.1, Revision 1.77

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