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

1.80    ! ratchov     1: .\"    $OpenBSD: aucat.1,v 1.79 2011/05/23 07:06:53 jmc Exp $
1.1       kstailey    2: .\"
1.16      ratchov     3: .\" Copyright (c) 2006 Alexandre Ratchov <alex@caoua.org>
1.1       kstailey    4: .\"
1.16      ratchov     5: .\" Permission to use, copy, modify, and distribute this software for any
                      6: .\" purpose with or without fee is hereby granted, provided that the above
                      7: .\" copyright notice and this permission notice appear in all copies.
1.1       kstailey    8: .\"
1.16      ratchov     9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       kstailey   16: .\"
1.80    ! ratchov    17: .Dd $Mdocdate: May 23 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.31      jmc       251: corresponding to \-42dB and \-0dB attenuation.
1.33      ratchov   252: In server mode, clients inherit this parameter.
1.34      jmc       253: Reducing the volume in advance reduces a client's dynamic range,
                    254: but allows client volume to stay independent from the number
1.33      ratchov   255: of clients as long as their number is small enough.
1.34      jmc       256: A good compromise is to use \-4dB attenuation (12 volume units)
                    257: for each additional client expected
                    258: (115 if 2 clients are expected, 103 for 3 clients, and so on).
1.80    ! ratchov   259: .It Fl w Ar flag
        !           260: Control
        !           261: .Nm
        !           262: behaviour when the maximum volume of the hardware is reached
        !           263: and a new stream is connected.
        !           264: This happens only when stream volumes
        !           265: are not properly set using the
        !           266: .Fl v
        !           267: option.
        !           268: If the flag is
        !           269: .Va on ,
        !           270: then the master volume (corresponding to the mix of all playback streams)
        !           271: is automatically adjusted to avoid clipping.
        !           272: Using
        !           273: .Fl w Va off
        !           274: makes sense when all streams are recorded or produced with properly lowered
        !           275: volumes.
        !           276: The default is
        !           277: .Va on .
1.26      ratchov   278: .It Fl x Ar policy
1.22      ratchov   279: Action when the output stream cannot accept
1.26      ratchov   280: recorded data fast enough or the input stream
                    281: cannot provide data to play fast enough.
1.22      ratchov   282: If the policy
                    283: is
1.23      jmc       284: .Dq ignore
1.26      ratchov   285: (the default) then samples that cannot be written are discarded
                    286: and samples that cannot be read are replaced by silence.
1.22      ratchov   287: If the policy is
1.23      jmc       288: .Dq sync
1.72      jmc       289: then recorded samples are discarded,
                    290: but the same amount of silence will be written
1.22      ratchov   291: once the stream is unblocked, in order to reach the right position in time.
1.26      ratchov   292: Similarly silence is played, but the same amount of samples will be discarded
                    293: once the stream is unblocked.
1.22      ratchov   294: If the policy is
1.23      jmc       295: .Dq error
                    296: then the stream is closed permanently.
1.62      ratchov   297: .Pp
1.71      ratchov   298: If a stream is created with the
1.67      jmc       299: .Fl t
                    300: option,
1.63      jmc       301: the
1.62      ratchov   302: .Dq ignore
1.63      jmc       303: action is disabled for any stream connected to it
                    304: to ensure proper synchronization.
1.62      ratchov   305: .It Fl z Ar nframes
1.71      ratchov   306: The audio device block size in frames.
1.63      jmc       307: This is the number of frames between audio clock ticks,
                    308: i.e. the clock resolution.
1.71      ratchov   309: If a stream is created with the
1.67      jmc       310: .Fl t
                    311: option,
                    312: and MTC is used for synchronization, the clock
1.62      ratchov   313: resolution must be 96, 100 or 120 ticks per second for maximum
1.63      jmc       314: accuracy.
                    315: For instance, 120 ticks per second at 48000Hz corresponds
                    316: to a 400 frame block size.
1.21      jmc       317: .El
                    318: .Pp
1.71      ratchov   319: On the command line,
                    320: per-device parameters
1.80    ! ratchov   321: .Pq Fl abwz
1.71      ratchov   322: must precede the device definition
                    323: .Pq Fl f ,
                    324: and per-stream parameters
                    325: .Pq Fl Ccehjmrtvx
                    326: must precede the stream definition
                    327: .Pq Fl ios .
                    328: MIDI ports
                    329: .Pq Fl q
1.75      okan      330: and stream definitions
1.71      ratchov   331: .Pq Fl ios
                    332: must precede the definition of the device
                    333: .Pq Fl f
                    334: to which they are attached.
                    335: Global parameters
1.74      ratchov   336: .Pq Fl dlnUu
1.71      ratchov   337: are position-independent.
                    338: .Pp
                    339: If no audio devices
                    340: .Pq Fl f
                    341: are specified,
                    342: settings are applied as if
                    343: the default device is specified as the last argument.
                    344: If no streams
                    345: .Pq Fl ios
                    346: are specified for a device, a default server sub-device is
                    347: created attached to it, meaning that
                    348: .Nm
                    349: behaves as an audio server.
                    350: The default
                    351: .Xr sndio 7
                    352: device is
                    353: .Pa aucat:0
                    354: .Pq also known as Pa aucat:0.default
                    355: .Pp
1.32      ratchov   356: If
                    357: .Nm
                    358: is sent
1.44      ratchov   359: .Dv SIGHUP ,
                    360: .Dv SIGINT
                    361: or
                    362: .Dv SIGTERM ,
1.32      ratchov   363: it terminates recording to files.
                    364: .Pp
1.20      jmc       365: File formats are specified using the
                    366: .Fl h
1.26      ratchov   367: option.
1.16      ratchov   368: The following file formats are supported:
1.66      ratchov   369: .Bl -tag -width s32lexxx -offset indent
1.16      ratchov   370: .It raw
                    371: Headerless file.
1.17      jmc       372: This format is recommended since it has no limitations.
1.16      ratchov   373: .It wav
                    374: Microsoft WAVE file format.
                    375: There are limitations inherent to the file format itself:
                    376: not all encodings are supported,
                    377: file sizes are limited to 2GB,
1.17      jmc       378: and the file must support the
1.16      ratchov   379: .Xr lseek 2
1.17      jmc       380: operation (e.g. pipes do not support it).
1.16      ratchov   381: .It auto
                    382: Try to guess, depending on the file name.
1.9       millert   383: .El
                    384: .Pp
1.20      jmc       385: Encodings are specified using the
                    386: .Fl e
1.26      ratchov   387: option.
1.16      ratchov   388: The following encodings are supported:
                    389: .Pp
1.66      ratchov   390: .Bl -tag -width s32lexxx -offset indent -compact
1.16      ratchov   391: .It s8
                    392: signed 8-bit
                    393: .It u8
                    394: unsigned 8-bit
                    395: .It s16le
                    396: signed 16-bit, little endian
                    397: .It u16le
                    398: unsigned 16-bit, little endian
                    399: .It s16be
                    400: signed 16-bit, big endian
                    401: .It u16be
                    402: unsigned 16-bit, big endian
                    403: .It s24le
                    404: signed 24-bit, stored in 4 bytes, little endian
                    405: .It u24le
                    406: unsigned 24-bit, stored in 4 bytes, little endian
                    407: .It s24be
                    408: signed 24-bit, stored in 4 bytes, big endian
                    409: .It u24be
                    410: unsigned 24-bit, stored in 4 bytes, big endian
                    411: .It s32le
                    412: signed 32-bit, little endian
                    413: .It u32le
                    414: unsigned 32-bit, little endian
                    415: .It s32be
                    416: signed 32-bit, big endian
                    417: .It u32be
                    418: unsigned 32-bit, big endian
                    419: .It s24le3
                    420: signed 24-bit, packed in 3 bytes, little endian
                    421: .It u24le3
                    422: unsigned 24-bit, packed in 3 bytes, big endian
                    423: .It s24be3
                    424: signed 24-bit, packed in 3 bytes, little endian
                    425: .It u24be3
                    426: unsigned 24-bit, packed in 3 bytes, big endian
                    427: .It s20le3
                    428: signed 20-bit, packed in 3 bytes, little endian
                    429: .It u20le3
                    430: unsigned 20-bit, packed in 3 bytes, big endian
                    431: .It s20be3
                    432: signed 20-bit, packed in 3 bytes, little endian
                    433: .It u20be3
                    434: unsigned 20-bit, packed in 3 bytes, big endian
                    435: .It s18le3
                    436: signed 18-bit, packed in 3 bytes, little endian
                    437: .It u18le3
                    438: unsigned 18-bit, packed in 3 bytes, big endian
                    439: .It s18be3
                    440: signed 18-bit, packed in 3 bytes, little endian
                    441: .It u18be3
                    442: unsigned 18-bit, packed in 3 bytes, big endian
                    443: .El
1.46      ratchov   444: .Sh SERVER MODE
1.71      ratchov   445: If at least one sub-device
                    446: .Pq Fl s
                    447: is exposed by
                    448: .Nm ,
                    449: including the case when no stream options are given,
                    450: then
1.46      ratchov   451: .Nm
1.71      ratchov   452: can be used as a server
1.46      ratchov   453: to overcome hardware limitations and allow applications
                    454: to run on fixed sample rate devices or on devices
                    455: supporting only unusual encodings.
1.69      ratchov   456: .Pp
1.46      ratchov   457: Certain applications, such as synthesis software,
                    458: require a low latency audio setup.
1.71      ratchov   459: To reduce the probability of buffer underruns or overruns, especially
                    460: on busy machines, the server can be started by the super-user, in which
                    461: case it will run with higher priority.
1.72      jmc       462: Any user will still be able to connect to it,
                    463: but for privacy reasons only one user may have
1.71      ratchov   464: connections to it at a given time.
1.55      ratchov   465: .Sh MIDI CONTROL
                    466: .Nm
1.71      ratchov   467: can expose the audio device clock on registered
                    468: MIDI ports
                    469: .Pq Fl q
                    470: and allows audio device properties to be controlled
                    471: through MIDI.
                    472: If running in server mode
1.62      ratchov   473: .Nm
1.71      ratchov   474: creates a MIDI port with the same name as the default audio
                    475: device to which MIDI programs can connect.
1.62      ratchov   476: .Pp
1.56      jmc       477: A MIDI channel is assigned to each stream, and the volume
1.55      ratchov   478: is changed using the standard volume controller (number 7).
1.71      ratchov   479: Similarly, when the audio client changes its volume,
1.55      ratchov   480: the same MIDI controller message is sent out; it can be used
1.56      jmc       481: for instance for monitoring or as feedback for motorized
1.55      ratchov   482: faders.
1.62      ratchov   483: .Pp
1.71      ratchov   484: Streams created with the
1.63      jmc       485: .Fl t
1.67      jmc       486: option are controlled by the following MMC messages:
1.66      ratchov   487: .Bl -tag -width relocateXXX -offset indent
1.62      ratchov   488: .It relocate
1.79      jmc       489: Streams are relocated to the requested time position
1.71      ratchov   490: relative to the beginning of the stream, at which playback
1.62      ratchov   491: and recording must start.
1.71      ratchov   492: If the requested position is beyond the end of file,
1.79      jmc       493: the stream is temporarly disabled until a valid position is requested.
1.71      ratchov   494: This message is ignored by client streams (server mode).
                    495: The given time position is sent to MIDI ports as an MTC
1.62      ratchov   496: .Dq "full frame"
                    497: message forcing all MTC-slaves to relocate to the given
                    498: position (see below).
                    499: .It start
1.71      ratchov   500: Put all streams in starting mode.
                    501: In this mode,
                    502: .Nm
                    503: waits for all streams to become ready
1.62      ratchov   504: to start, and then starts them synchronously.
1.72      jmc       505: Once started, new streams can be created (server mode)
                    506: but they will be blocked
1.62      ratchov   507: until the next stop-to-start transition.
1.67      jmc       508: .It stop
1.71      ratchov   509: Put all streams in stopped mode (the default).
1.67      jmc       510: In this mode, any stream attempting to start playback or recording
                    511: is paused.
1.71      ratchov   512: Files are stopped and rewound back to the starting position,
                    513: while client streams (server mode) that are already
                    514: started are not affected until they stop and try to start again.
1.62      ratchov   515: .El
                    516: .Pp
1.71      ratchov   517: Streams created with the
1.63      jmc       518: .Fl t
1.67      jmc       519: option export the server clock using MTC, allowing non-audio
1.62      ratchov   520: software or hardware to be synchronized to the audio stream.
                    521: The following sample rates
                    522: .Pq Fl r
                    523: and block sizes
                    524: .Pq Fl z
                    525: are recommended for maximum accuracy:
                    526: .Pp
1.66      ratchov   527: .Bl -bullet -offset indent -compact
1.62      ratchov   528: .It
                    529: 44100Hz, 441 frames
                    530: .It
                    531: 48000Hz, 400 frames
                    532: .It
                    533: 48000Hz, 480 frames
                    534: .It
                    535: 48000Hz, 500 frames
                    536: .El
                    537: .Pp
                    538: For instance, the following command will create two devices:
                    539: the default
                    540: .Va aucat:0
1.63      jmc       541: and a MIDI-controlled
                    542: .Va aucat:0.mmc :
1.62      ratchov   543: .Bd -literal -offset indent
                    544: $ aucat -l -r 48000 -z 400 -s default -t slave -s mmc
                    545: .Ed
                    546: .Pp
                    547: Streams connected to
                    548: .Va aucat:0
                    549: behave normally, while streams connected to
                    550: .Va aucat:0.mmc
                    551: wait for the MMC start signal and start synchronously.
1.63      jmc       552: Regardless of which device a stream is connected to,
                    553: its playback volume knob is exposed.
1.66      ratchov   554: .Pp
                    555: For instance, the following command will play a file on the
                    556: .Va aucat:0.mmc
                    557: audio device, and give full control to MIDI software or hardware
                    558: connected to the
                    559: .Va midithru:0
                    560: MIDI device:
                    561: .Bd -literal -offset indent
1.70      ratchov   562: $ aucat -t slave -q midithru:0 -i file.wav -f aucat:0.mmc
1.66      ratchov   563: .Ed
                    564: .Pp
                    565: At this stage,
                    566: .Nm
                    567: will start, stop and relocate automatically following all user
                    568: actions in the MIDI sequencer.
                    569: Note that the sequencer must use
                    570: .Va aucat:0
                    571: as the MTC source, i.e. the audio server, not the audio player.
1.9       millert   572: .Sh ENVIRONMENT
1.76      ratchov   573: .Bl -tag -width "AUCAT_COOKIE" -compact
                    574: .It Ev AUCAT_COOKIE
1.77      jmc       575: File containing user's session cookie.
1.24      jmc       576: .It Ev AUDIODEVICE
1.57      ratchov   577: .Xr sndio 7
                    578: audio device to use if the
1.50      ratchov   579: .Fl f
                    580: option is not specified.
1.9       millert   581: .El
1.16      ratchov   582: .Sh EXAMPLES
1.77      jmc       583: Mix and play two stereo streams,
1.16      ratchov   584: the first at 48kHz and the second at 44.1kHz:
                    585: .Bd -literal -offset indent
                    586: $ aucat -r 48000 -i file1.raw -r 44100 -i file2.raw
                    587: .Ed
                    588: .Pp
1.77      jmc       589: Record channels 2 and 3 into one stereo file and
1.16      ratchov   590: channels 6 and 7 into another stereo file using a 96kHz sampling rate for
                    591: both:
                    592: .Bd -literal -offset indent
1.26      ratchov   593: $ aucat -r 96000 -C 2:3 -o file1.raw -C 6:7 -o file2.raw
1.42      ratchov   594: .Ed
                    595: .Pp
1.77      jmc       596: Split a stereo file into two mono files:
1.42      ratchov   597: .Bd -literal -offset indent
                    598: $ aucat -n -i stereo.wav -C 0:0 -o left.wav -C 1:1 -o right.wav
1.16      ratchov   599: .Ed
                    600: .Pp
1.77      jmc       601: Start
1.35      ratchov   602: .Nm
1.77      jmc       603: in server mode using default parameters, creating an
1.57      ratchov   604: additional sub-device for output to channels 2:3 only (rear speakers
                    605: on most cards), exposing the
                    606: .Pa aucat:0
                    607: and
                    608: .Pa aucat:0.rear
                    609: devices:
1.35      ratchov   610: .Bd -literal -offset indent
1.45      ratchov   611: $ aucat -l -s default -c 2:3 -s rear
1.35      ratchov   612: .Ed
                    613: .Pp
1.77      jmc       614: Start
1.35      ratchov   615: .Nm
1.77      jmc       616: in server mode, creating the default sub-device with low volume and
1.57      ratchov   617: an additional sub-device for high volume output, exposing the
                    618: .Pa aucat:0
                    619: and
                    620: .Pa aucat:0.max
                    621: devices:
1.35      ratchov   622: .Bd -literal -offset indent
1.45      ratchov   623: $ aucat -l -v 65 -s default -v 127 -s max
1.16      ratchov   624: .Ed
1.71      ratchov   625: .Pp
1.77      jmc       626: Start
1.71      ratchov   627: .Nm
1.77      jmc       628: in server mode, configuring the audio device to use
1.72      jmc       629: a 48kHz sample frequency, 240-frame block size,
                    630: and 2-block buffers.
1.71      ratchov   631: The corresponding latency is 10ms, which is
                    632: the time it takes the sound to propagate 3.5 meters.
                    633: .Bd -literal -offset indent
                    634: $ aucat -l -r 48000 -b 480 -z 240
                    635: .Ed
1.2       kstailey  636: .Sh SEE ALSO
1.12      jmc       637: .Xr audioctl 1 ,
1.17      jmc       638: .Xr cdio 1 ,
1.9       millert   639: .Xr mixerctl 1 ,
1.54      ratchov   640: .Xr audio 4 ,
                    641: .Xr sndio 7
1.16      ratchov   642: .Sh BUGS
                    643: The
1.1       kstailey  644: .Nm
1.16      ratchov   645: utility assumes non-blocking I/O for input and output streams.
                    646: It will not work reliably on files that may block
                    647: (ordinary files block, pipes don't).
1.71      ratchov   648: To avoid audio underruns/overruns or MIDI jitter caused by file I/O,
                    649: it's recommended to use two
                    650: .Nm
                    651: processes: a server handling audio and MIDI I/O and a client handling
                    652: disk I/O.
1.16      ratchov   653: .Pp
                    654: Resampling is low quality; down-sampling especially should be avoided
                    655: when recording.
                    656: .Pp
                    657: Processing is done using 16-bit arithmetic,
                    658: thus samples with more than 16 bits are rounded.
1.17      jmc       659: 16 bits (i.e. 97dB dynamic) are largely enough for most applications though.
1.71      ratchov   660: .Pp
                    661: If
                    662: .Fl a Ar off
1.72      jmc       663: is used in server mode,
1.71      ratchov   664: .Nm
1.72      jmc       665: creates sub-devices to expose first
                    666: and then opens the audio hardware on demand.
1.71      ratchov   667: Technically, this allows
                    668: .Nm
1.75      okan      669: to attempt to use one of the sub-devices it exposes as an audio device,
1.71      ratchov   670: creating a deadlock.
                    671: To avoid this,
                    672: .Fl a Ar off
                    673: is disabled for the default audio device, but nothing prevents the user
                    674: from shooting himself in the foot by creating a similar deadlock.