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

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