[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.75

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