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

1.53    ! ratchov     1: .\"    $OpenBSD: aucat.1,v 1.52 2009/04/11 10:24:21 jakemsr 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.53    ! ratchov    17: .Dd $Mdocdate: April 11 2009 $
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.42      ratchov    26: .Op Fl lnu
1.49      jmc        27: .Op Fl b Ar nframes
1.16      ratchov    28: .Op Fl C Ar min : Ns Ar max
                     29: .Op Fl c Ar min : Ns Ar max
                     30: .Op Fl e Ar enc
1.9       millert    31: .Op Fl f Ar device
1.16      ratchov    32: .Op Fl h Ar fmt
                     33: .Op Fl i Ar file
1.37      ratchov    34: .Op Fl m Ar mode
1.16      ratchov    35: .Op Fl o Ar file
                     36: .Op Fl r Ar rate
1.40      jmc        37: .Op Fl s Ar socket
1.30      ratchov    38: .Op Fl v Ar volume
1.22      ratchov    39: .Op Fl x Ar policy
1.16      ratchov    40: .Ek
1.1       kstailey   41: .Sh DESCRIPTION
                     42: The
1.7       aaron      43: .Nm
1.16      ratchov    44: utility can record one input stream
                     45: and store it on multiple destination files,
                     46: doing the necessary conversions on the fly.
1.48      ratchov    47: It can play, convert, and mix multiple input files simultaneously,
                     48: and can also act as an audio server.
1.9       millert    49: .Nm
1.16      ratchov    50: also has a legacy mode that works like previous versions of
                     51: .Nm ,
                     52: which does not convert on the fly and supports playback of .au files.
1.17      jmc        53: .Pp
1.16      ratchov    54: The options are as follows:
1.26      ratchov    55: .Bl -tag -width Ds
1.49      jmc        56: .It Fl b Ar nframes
1.26      ratchov    57: The buffer size in frames.
1.49      jmc        58: A frame consists of one sample for each channel in the stream.
                     59: This is the number of frames that will be buffered before being played
                     60: and thus controls the playback latency.
1.25      jmc        61: .It Xo
                     62: .Fl C Ar min : Ns Ar max ,
                     63: .Fl c Ar min : Ns Ar max
                     64: .Xc
1.26      ratchov    65: The range of channel numbers on the record or playback stream, respectively.
1.17      jmc        66: The default is 0:1, i.e. stereo.
1.26      ratchov    67: .It Fl e Ar enc
                     68: Encoding of the playback or recording stream (see below).
1.17      jmc        69: The default is signed, 16-bit, native byte order.
                     70: .It Fl f Ar device
                     71: The
                     72: .Xr audio 4
1.50      ratchov    73: device or
                     74: .Nm
                     75: socket to use for playing and/or recording.
1.26      ratchov    76: .It Fl h Ar fmt
                     77: File format of the playback or record stream (see below).
1.17      jmc        78: The default is auto.
1.16      ratchov    79: .It Fl i Ar file
                     80: Add this file to the list of files to play.
                     81: If the option argument is
                     82: .Sq -
                     83: then standard input will be used.
1.26      ratchov    84: .It Fl l
1.35      ratchov    85: Listen for incoming connections on Unix domain sockets.
1.39      jmc        86: This allows clients to use
1.26      ratchov    87: .Nm
                     88: instead of the regular
                     89: .Xr audio 4
                     90: device for audio input and output
                     91: in order to share the physical device with other clients.
1.45      ratchov    92: The default socket name is
                     93: .Pa default
                     94: but other names can be used with the
1.35      ratchov    95: .Fl s
                     96: option.
1.37      ratchov    97: .It Fl m Ar mode
                     98: Set the server mode.
                     99: Valid modes are
1.39      jmc       100: .Ar play ,
                    101: .Ar rec ,
1.37      ratchov   102: and
1.39      jmc       103: .Ar duplex ,
                    104: for play-only, record-only, and full-duplex, respectively.
1.37      ratchov   105: The default is
1.39      jmc       106: .Ar duplex .
1.42      ratchov   107: .It Fl n
                    108: Loopback mode.
                    109: Instead of using an audio device, send input streams
                    110: to the output, processing them on the fly.
                    111: This mode is useful to mix, demultiplex, resample or reencode
1.43      jmc       112: audio files offline.
1.16      ratchov   113: .It Fl o Ar file
                    114: Add this file to the list of files in which to store recorded samples.
                    115: If the option argument is
                    116: .Sq -
                    117: then standard output will be used.
1.26      ratchov   118: .It Fl r Ar rate
                    119: Sample rate in Hertz of the playback or record stream.
1.17      jmc       120: The default is 44100Hz.
1.40      jmc       121: .It Fl s Ar socket
1.45      ratchov   122: Add the name
1.40      jmc       123: .Ar socket
                    124: to the list of sockets to listen on.
1.45      ratchov   125: .Ar socket
                    126: cannot contain '/'.
1.39      jmc       127: Meaningful in server mode only.
1.16      ratchov   128: .It Fl u
1.21      jmc       129: Normally
                    130: .Nm
                    131: tries to automatically determine the optimal parameters for the audio device;
                    132: if this option is specified,
                    133: it will instead use the parameters specified by the
1.26      ratchov   134: .Fl Ccer
1.21      jmc       135: options.
1.30      ratchov   136: .It Fl v Ar volume
                    137: Software volume attenuation of the playback stream.
                    138: The value must be between 1 and 127,
1.31      jmc       139: corresponding to \-42dB and \-0dB attenuation.
1.33      ratchov   140: In server mode, clients inherit this parameter.
1.34      jmc       141: Reducing the volume in advance reduces a client's dynamic range,
                    142: but allows client volume to stay independent from the number
1.33      ratchov   143: of clients as long as their number is small enough.
1.34      jmc       144: A good compromise is to use \-4dB attenuation (12 volume units)
                    145: for each additional client expected
                    146: (115 if 2 clients are expected, 103 for 3 clients, and so on).
1.26      ratchov   147: .It Fl x Ar policy
1.22      ratchov   148: Action when the output stream cannot accept
1.26      ratchov   149: recorded data fast enough or the input stream
                    150: cannot provide data to play fast enough.
1.22      ratchov   151: If the policy
                    152: is
1.23      jmc       153: .Dq ignore
1.26      ratchov   154: (the default) then samples that cannot be written are discarded
                    155: and samples that cannot be read are replaced by silence.
1.22      ratchov   156: If the policy is
1.23      jmc       157: .Dq sync
1.26      ratchov   158: then recorded samples are discarded, but the same amount of silence will be written
1.22      ratchov   159: once the stream is unblocked, in order to reach the right position in time.
1.26      ratchov   160: Similarly silence is played, but the same amount of samples will be discarded
                    161: once the stream is unblocked.
1.22      ratchov   162: If the policy is
1.23      jmc       163: .Dq error
                    164: then the stream is closed permanently.
1.21      jmc       165: .El
                    166: .Pp
1.32      ratchov   167: If
                    168: .Nm
                    169: is sent
1.44      ratchov   170: .Dv SIGHUP ,
                    171: .Dv SIGINT
                    172: or
                    173: .Dv SIGTERM ,
1.32      ratchov   174: it terminates recording to files.
                    175: If sent
                    176: .Dv SIGUSR1
                    177: or
                    178: .Dv SIGUSR2 ,
                    179: it increases or decreases debug level, respectively.
                    180: .Pp
1.35      ratchov   181: Settings for input files
                    182: .Pq Fl i ,
                    183: output files
1.39      jmc       184: .Pq Fl o ,
1.35      ratchov   185: and sockets
                    186: .Pq Fl s
                    187: can be changed using the
                    188: .Fl Ccehrvx
1.16      ratchov   189: options.
1.21      jmc       190: The last
1.35      ratchov   191: .Fl Ccehrvx
1.23      jmc       192: options specified before an
1.35      ratchov   193: .Fl i ,
1.39      jmc       194: .Fl o ,
                    195: or
1.35      ratchov   196: .Fl s
1.41      jmc       197: are applied to the corresponding file.
1.21      jmc       198: .Pp
                    199: Settings for the audio device
                    200: can be changed using the
1.26      ratchov   201: .Fl Ccer
1.21      jmc       202: options.
                    203: They apply to the audio device only if the
                    204: .Fl u
                    205: option is given as well.
                    206: The last
1.26      ratchov   207: .Fl Ccer
1.21      jmc       208: option specified before an
1.16      ratchov   209: .Fl f
1.21      jmc       210: is applied to
                    211: .Ar device .
                    212: .Pp
                    213: If no audio device
                    214: .Pq Fl f
1.53    ! ratchov   215: is specified,
        !           216: settings are applied as if
        !           217: the default device is specified as the last argument.
        !           218: If no sockets
        !           219: .Pq Fl s
        !           220: are specified
        !           221: settings are applied as if
        !           222: the default socket is specified as the last argument.
1.14      jmc       223: .Pp
1.20      jmc       224: File formats are specified using the
                    225: .Fl h
1.26      ratchov   226: option.
1.16      ratchov   227: The following file formats are supported:
                    228: .Bl -tag -width s32lexxx -offset -indent
                    229: .It raw
                    230: Headerless file.
1.17      jmc       231: This format is recommended since it has no limitations.
1.16      ratchov   232: .It wav
                    233: Microsoft WAVE file format.
                    234: There are limitations inherent to the file format itself:
                    235: not all encodings are supported,
                    236: file sizes are limited to 2GB,
1.17      jmc       237: and the file must support the
1.16      ratchov   238: .Xr lseek 2
1.17      jmc       239: operation (e.g. pipes do not support it).
1.16      ratchov   240: .It auto
                    241: Try to guess, depending on the file name.
1.9       millert   242: .El
                    243: .Pp
1.20      jmc       244: Encodings are specified using the
                    245: .Fl e
1.26      ratchov   246: option.
1.16      ratchov   247: The following encodings are supported:
                    248: .Pp
                    249: .Bl -tag -width s32lexxx -offset -indent -compact
                    250: .It s8
                    251: signed 8-bit
                    252: .It u8
                    253: unsigned 8-bit
                    254: .It s16le
                    255: signed 16-bit, little endian
                    256: .It u16le
                    257: unsigned 16-bit, little endian
                    258: .It s16be
                    259: signed 16-bit, big endian
                    260: .It u16be
                    261: unsigned 16-bit, big endian
                    262: .It s24le
                    263: signed 24-bit, stored in 4 bytes, little endian
                    264: .It u24le
                    265: unsigned 24-bit, stored in 4 bytes, little endian
                    266: .It s24be
                    267: signed 24-bit, stored in 4 bytes, big endian
                    268: .It u24be
                    269: unsigned 24-bit, stored in 4 bytes, big endian
                    270: .It s32le
                    271: signed 32-bit, little endian
                    272: .It u32le
                    273: unsigned 32-bit, little endian
                    274: .It s32be
                    275: signed 32-bit, big endian
                    276: .It u32be
                    277: unsigned 32-bit, big endian
                    278: .It s24le3
                    279: signed 24-bit, packed in 3 bytes, little endian
                    280: .It u24le3
                    281: unsigned 24-bit, packed in 3 bytes, big endian
                    282: .It s24be3
                    283: signed 24-bit, packed in 3 bytes, little endian
                    284: .It u24be3
                    285: unsigned 24-bit, packed in 3 bytes, big endian
                    286: .It s20le3
                    287: signed 20-bit, packed in 3 bytes, little endian
                    288: .It u20le3
                    289: unsigned 20-bit, packed in 3 bytes, big endian
                    290: .It s20be3
                    291: signed 20-bit, packed in 3 bytes, little endian
                    292: .It u20be3
                    293: unsigned 20-bit, packed in 3 bytes, big endian
                    294: .It s18le3
                    295: signed 18-bit, packed in 3 bytes, little endian
                    296: .It u18le3
                    297: unsigned 18-bit, packed in 3 bytes, big endian
                    298: .It s18be3
                    299: signed 18-bit, packed in 3 bytes, little endian
                    300: .It u18be3
                    301: unsigned 18-bit, packed in 3 bytes, big endian
                    302: .El
1.46      ratchov   303: .Sh SERVER MODE
                    304: .Nm
                    305: can be used in server mode
                    306: .Pq Fl l
                    307: to overcome hardware limitations and allow applications
                    308: to run on fixed sample rate devices or on devices
                    309: supporting only unusual encodings.
                    310: It is generally not desirable to have multiple
                    311: instances of
                    312: .Nm
                    313: running in server mode,
                    314: so it is good practice to start it thus:
                    315: .Bd -literal -offset indent
                    316: $ pgrep -x aucat || aucat -l
                    317: .Ed
                    318: .Pp
                    319: This also ensures privacy by preventing
                    320: other users from accessing the audio system.
                    321: On multi-user machines
                    322: .Nm
                    323: should be killed when no longer in use to make audio resources
                    324: available again to others:
                    325: .Bd -literal -offset indent
                    326: $ pkill -x aucat
                    327: .Ed
                    328: .Pp
                    329: Certain applications, such as synthesis software,
                    330: require a low latency audio setup.
                    331: To reduce the probability of buffer underruns or overruns,
                    332: the
                    333: .Xr renice 8
1.49      jmc       334: command can be used to give a higher priority to the
1.46      ratchov   335: .Nm
1.49      jmc       336: process.
1.46      ratchov   337: Superuser privileges are required.
                    338: For example:
                    339: .Bd -literal -offset indent
                    340: $ aucat -b 3500 -l
                    341: $ sudo renice -n -20 -p `pgrep -x aucat`
                    342: .Ed
1.16      ratchov   343: .Sh LEGACY MODE
                    344: If neither
                    345: .Fl i
                    346: nor
                    347: .Fl o
1.17      jmc       348: are specified,
1.16      ratchov   349: .Nm
1.17      jmc       350: will run in legacy mode, and won't convert sample formats or sampling rates.
1.16      ratchov   351: In legacy mode, all options except
1.17      jmc       352: .Fl f
                    353: are ignored, and all other arguments are assumed to be names of files.
1.16      ratchov   354: In legacy mode
                    355: .Nm
                    356: reads files sequentially, and writes them to the specified device.
                    357: If a Sun .au header is detected it is skipped over and not copied to
                    358: the audio device.
                    359: .Nm
1.52      jakemsr   360: will attempt to parse the format, number of channels and sample rate
                    361: from Sun .au file headers.
                    362: However, only alaw and ulaw formats are supported for .au files.
                    363: Other formats will be interpreted as ulaw.
1.16      ratchov   364: If a Microsoft .wav header (RIFF) is detected it is interpreted
                    365: to select the right audio encoding for playback and the data chunk of the
                    366: file is copied to the audio device.
                    367: If the device does not support the encoding,
                    368: .Nm
                    369: will exit with an error.
1.9       millert   370: .Sh ENVIRONMENT
1.35      ratchov   371: .Bl -tag -width "AUDIODEVICE" -compact
1.22      ratchov   372: .It Ev AUCAT_DEBUG
                    373: The debug level:
                    374: may be a value between 0 and 4.
1.24      jmc       375: .It Ev AUDIODEVICE
1.50      ratchov   376: Name of the
1.51      jmc       377: .Nm
1.50      ratchov   378: socket to connect to, or path to the
                    379: .Xr audio 4
                    380: device to use if the
                    381: .Fl f
                    382: option is not specified.
1.9       millert   383: .El
1.16      ratchov   384: .Sh EXAMPLES
                    385: The following will mix and play two stereo streams,
                    386: the first at 48kHz and the second at 44.1kHz:
                    387: .Bd -literal -offset indent
                    388: $ aucat -r 48000 -i file1.raw -r 44100 -i file2.raw
                    389: .Ed
                    390: .Pp
                    391: The following will record channels 2 and 3 into one stereo file and
                    392: channels 6 and 7 into another stereo file using a 96kHz sampling rate for
                    393: both:
                    394: .Bd -literal -offset indent
1.26      ratchov   395: $ aucat -r 96000 -C 2:3 -o file1.raw -C 6:7 -o file2.raw
1.42      ratchov   396: .Ed
                    397: .Pp
1.43      jmc       398: The following will split a stereo file into two mono files:
1.42      ratchov   399: .Bd -literal -offset indent
                    400: $ aucat -n -i stereo.wav -C 0:0 -o left.wav -C 1:1 -o right.wav
1.16      ratchov   401: .Ed
                    402: .Pp
1.35      ratchov   403: The following will start
                    404: .Nm
1.40      jmc       405: in server mode using default parameters, but will create an
1.35      ratchov   406: additional socket for output to channels 2:3 only (rear speakers
1.39      jmc       407: on most cards):
1.35      ratchov   408: .Bd -literal -offset indent
1.45      ratchov   409: $ aucat -l -s default -c 2:3 -s rear
1.35      ratchov   410: .Ed
                    411: .Pp
                    412: The following will start
                    413: .Nm
1.39      jmc       414: in server mode creating the default socket with low volume and
                    415: an additional socket for high volume output:
1.35      ratchov   416: .Bd -literal -offset indent
1.45      ratchov   417: $ aucat -l -v 65 -s default -v 127 -s max
1.16      ratchov   418: .Ed
1.2       kstailey  419: .Sh SEE ALSO
1.12      jmc       420: .Xr audioctl 1 ,
1.17      jmc       421: .Xr cdio 1 ,
1.9       millert   422: .Xr mixerctl 1 ,
1.2       kstailey  423: .Xr audio 4
1.16      ratchov   424: .Sh BUGS
                    425: The
1.1       kstailey  426: .Nm
1.16      ratchov   427: utility assumes non-blocking I/O for input and output streams.
                    428: It will not work reliably on files that may block
                    429: (ordinary files block, pipes don't).
                    430: .Pp
                    431: Resampling is low quality; down-sampling especially should be avoided
                    432: when recording.
                    433: .Pp
                    434: Processing is done using 16-bit arithmetic,
                    435: thus samples with more than 16 bits are rounded.
1.17      jmc       436: 16 bits (i.e. 97dB dynamic) are largely enough for most applications though.