Home | History | Annotate | Line # | Download | only in record
record.c revision 1.10.4.1
      1 /*	$NetBSD: record.c,v 1.10.4.1 2002/01/29 23:18:12 he Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1999 Matthew R. Green
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. The name of the author may not be used to endorse or promote products
     16  *    derived from this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     23  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28  * SUCH DAMAGE.
     29  */
     30 
     31 /*
     32  * SunOS compatible audiorecord(1)
     33  */
     34 
     35 #include <sys/types.h>
     36 #include <sys/audioio.h>
     37 #include <sys/ioctl.h>
     38 #include <sys/time.h>
     39 #include <sys/uio.h>
     40 
     41 #include <err.h>
     42 #include <fcntl.h>
     43 #include <paths.h>
     44 #include <signal.h>
     45 #include <stdio.h>
     46 #include <stdlib.h>
     47 #include <string.h>
     48 #include <unistd.h>
     49 
     50 #include "libaudio.h"
     51 #include "auconv.h"
     52 
     53 audio_info_t info, oinfo;
     54 ssize_t	total_size = -1;
     55 const char *device;
     56 const char *ctldev;
     57 int	format = AUDIO_FORMAT_SUN;
     58 char	*header_info;
     59 char	default_info[8] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
     60 int	audiofd, ctlfd, outfd;
     61 int	qflag, aflag, fflag;
     62 int	verbose;
     63 int	monitor_gain, omonitor_gain;
     64 int	gain;
     65 int	balance;
     66 int	port;
     67 int	encoding;
     68 char	*encoding_str;
     69 int	precision;
     70 int	sample_rate;
     71 int	channels;
     72 struct timeval record_time;
     73 struct timeval start_time;	/* XXX because that's what gettimeofday returns */
     74 
     75 void (*conv_func) (u_char *, size_t);
     76 
     77 void usage (void);
     78 int main (int, char *[]);
     79 int timeleft (struct timeval *, struct timeval *);
     80 void cleanup (int) __attribute__((__noreturn__));
     81 int write_header_sun (void **, size_t *, int *);
     82 int write_header_wav (void **, size_t *, int *);
     83 void write_header (void);
     84 void rewrite_header (void);
     85 
     86 extern char *__progname;
     87 
     88 int
     89 main(argc, argv)
     90 	int argc;
     91 	char *argv[];
     92 {
     93 	char	*buffer;
     94 	size_t	len, bufsize;
     95 	int	ch, no_time_limit = 1;
     96 
     97 	while ((ch = getopt(argc, argv, "ab:C:F:c:d:e:fhi:m:P:p:qt:s:Vv:")) != -1) {
     98 		switch (ch) {
     99 		case 'a':
    100 			aflag++;
    101 			break;
    102 		case 'b':
    103 			decode_int(optarg, &balance);
    104 			if (balance < 0 || balance > 63)
    105 				errx(1, "balance must be between 0 and 63\n");
    106 			break;
    107 		case 'C':
    108 			ctldev = optarg;
    109 			break;
    110 		case 'F':
    111 			format = audio_format_from_str(optarg);
    112 			if (format < 0)
    113 				errx(1, "Unknown audio format; "
    114 				    "supported formats: \"sun\" and \"wav\"");
    115 			break;
    116 		case 'c':
    117 			decode_int(optarg, &channels);
    118 			if (channels < 0 || channels > 16)
    119 				errx(1, "channels must be between 0 and 16\n");
    120 			break;
    121 		case 'd':
    122 			device = optarg;
    123 			break;
    124 		case 'e':
    125 			encoding_str = optarg;
    126 			break;
    127 		case 'f':
    128 			fflag++;
    129 			break;
    130 		case 'i':
    131 			header_info = optarg;
    132 			break;
    133 		case 'm':
    134 			decode_int(optarg, &monitor_gain);
    135 			if (monitor_gain < 0 || monitor_gain > 255)
    136 				errx(1, "monitor volume must be between 0 and 255\n");
    137 			break;
    138 		case 'P':
    139 			decode_int(optarg, &precision);
    140 			if (precision != 4 && precision != 8 &&
    141 			    precision != 16 && precision != 24 &&
    142 			    precision != 32)
    143 				errx(1, "precision must be between 4, 8, 16, 24 or 32");
    144 			break;
    145 		case 'p':
    146 			len = strlen(optarg);
    147 
    148 			if (strncmp(optarg, "mic", len) == 0)
    149 				port |= AUDIO_MICROPHONE;
    150 			else if (strncmp(optarg, "cd", len) == 0 ||
    151 			           strncmp(optarg, "internal-cd", len) == 0)
    152 				port |= AUDIO_CD;
    153 			else if (strncmp(optarg, "line", len) == 0)
    154 				port |= AUDIO_LINE_IN;
    155 			else
    156 				errx(1,
    157 			    "port must be `cd', `internal-cd', `mic', or `line'");
    158 			break;
    159 		case 'q':
    160 			qflag++;
    161 			break;
    162 		case 's':
    163 			decode_int(optarg, &sample_rate);
    164 			if (sample_rate < 0 || sample_rate > 48000 * 2)	/* XXX */
    165 				errx(1, "sample rate must be between 0 and 96000\n");
    166 			break;
    167 		case 't':
    168 			no_time_limit = 0;
    169 			decode_time(optarg, &record_time);
    170 			break;
    171 		case 'V':
    172 			verbose++;
    173 			break;
    174 		case 'v':
    175 			decode_int(optarg, &gain);
    176 			if (gain < 0 || gain > 255)
    177 				errx(1, "volume must be between 0 and 255\n");
    178 			break;
    179 		/* case 'h': */
    180 		default:
    181 			usage();
    182 			/* NOTREACHED */
    183 		}
    184 	}
    185 	argc -= optind;
    186 	argv += optind;
    187 
    188 	/*
    189 	 * open the audio device, and control device
    190 	 */
    191 	if (device == NULL && (device = getenv("AUDIODEVICE")) == NULL &&
    192 	    (device = getenv("AUDIODEV")) == NULL) /* Sun compatibility */
    193 		device = _PATH_AUDIO;
    194 	if (ctldev == NULL && (ctldev = getenv("AUDIOCTLDEVICE")) == NULL)
    195 		ctldev = _PATH_AUDIOCTL;
    196 
    197 	audiofd = open(device, O_RDONLY);
    198 	if (audiofd < 0)
    199 		err(1, "failed to open %s", device);
    200 	ctlfd = open(ctldev, O_RDWR);
    201 	if (ctlfd < 0)
    202 		err(1, "failed to open %s", ctldev);
    203 
    204 	/*
    205 	 * work out the buffer size to use, and allocate it.  also work out
    206 	 * what the old monitor gain value is, so that we can reset it later.
    207 	 */
    208 	if (ioctl(ctlfd, AUDIO_GETINFO, &oinfo) < 0)
    209 		err(1, "failed to get audio info");
    210 	bufsize = oinfo.record.buffer_size;
    211 	if (bufsize < 32 * 1024)
    212 		bufsize = 32 * 1024;
    213 	omonitor_gain = oinfo.monitor_gain;
    214 
    215 	buffer = malloc(bufsize);
    216 	if (buffer == NULL)
    217 		err(1, "couldn't malloc buffer of %d size", (int)bufsize);
    218 
    219 	/*
    220 	 * open the output file
    221 	 */
    222 	if (argc != 1)
    223 		usage();
    224 	if (argv[0][0] != '-' && argv[0][1] != '\0') {
    225 		outfd = open(*argv, O_CREAT|(aflag ? O_APPEND : O_TRUNC)|O_WRONLY, 0666);
    226 		if (outfd < 0)
    227 			err(1, "could not open %s", *argv);
    228 	} else
    229 		outfd = STDOUT_FILENO;
    230 
    231 	/*
    232 	 * convert the encoding string into a value.
    233 	 */
    234 	if (encoding_str) {
    235 		encoding = audio_enc_to_val(encoding_str);
    236 		if (encoding == -1)
    237 			errx(1, "unknown encoding, bailing...");
    238 	}
    239 	else
    240 		encoding = AUDIO_ENCODING_ULAW;
    241 
    242 	/*
    243 	 * set up audio device for recording with the speified parameters
    244 	 */
    245 	AUDIO_INITINFO(&info);
    246 
    247 	/*
    248 	 * for these, get the current values for stuffing into the header
    249 	 */
    250 #define SETINFO(x)	if (x) info.record.x = x; else x = oinfo.record.x
    251 	SETINFO (sample_rate);
    252 	SETINFO (channels);
    253 	SETINFO (precision);
    254 	SETINFO (encoding);
    255 	SETINFO (gain);
    256 	SETINFO (port);
    257 	SETINFO (balance);
    258 #undef SETINFO
    259 
    260 	if (monitor_gain)
    261 		info.monitor_gain = monitor_gain;
    262 	else
    263 		monitor_gain = oinfo.monitor_gain;
    264 
    265 	info.mode = AUMODE_RECORD;
    266 	if (ioctl(ctlfd, AUDIO_SETINFO, &info) < 0)
    267 		err(1, "failed to reset audio info");
    268 
    269 	signal(SIGINT, cleanup);
    270 	write_header();
    271 	total_size = 0;
    272 
    273 	(void)gettimeofday(&start_time, NULL);
    274 	while (no_time_limit || timeleft(&start_time, &record_time)) {
    275 		if (read(audiofd, buffer, bufsize) != bufsize)
    276 			err(1, "read failed");
    277 		if (conv_func)
    278 			(*conv_func)(buffer, bufsize);
    279 		if (write(outfd, buffer, bufsize) != bufsize)
    280 			err(1, "write failed");
    281 		total_size += bufsize;
    282 	}
    283 	cleanup(0);
    284 }
    285 
    286 int
    287 timeleft(start_tvp, record_tvp)
    288 	struct timeval *start_tvp;
    289 	struct timeval *record_tvp;
    290 {
    291 	struct timeval now, diff;
    292 
    293 	(void)gettimeofday(&now, NULL);
    294 	timersub(&now, start_tvp, &diff);
    295 	timersub(record_tvp, &diff, &now);
    296 
    297 	return (now.tv_sec > 0 || (now.tv_sec == 0 && now.tv_usec > 0));
    298 }
    299 
    300 void
    301 cleanup(signo)
    302 	int signo;
    303 {
    304 
    305 	close(audiofd);
    306 	rewrite_header();
    307 	close(outfd);
    308 	if (omonitor_gain) {
    309 		AUDIO_INITINFO(&info);
    310 		info.monitor_gain = omonitor_gain;
    311 		if (ioctl(ctlfd, AUDIO_SETINFO, &info) < 0)
    312 			err(1, "failed to reset audio info");
    313 	}
    314 	close(ctlfd);
    315 	exit(0);
    316 }
    317 
    318 int
    319 write_header_sun(hdrp, lenp, leftp)
    320 	void **hdrp;
    321 	size_t *lenp;
    322 	int *leftp;
    323 {
    324 	static int warned = 0;
    325 	static sun_audioheader auh;
    326 	int sunenc, oencoding = encoding;
    327 
    328 	if (encoding == AUDIO_ENCODING_ULINEAR_LE) {
    329 		if (precision == 16)
    330 			conv_func = swap_bytes;
    331 		else if (precision == 32)
    332 			conv_func = swap_bytes32;
    333 		if (conv_func)
    334 			encoding = AUDIO_ENCODING_SLINEAR_BE;
    335 	} else if (encoding == AUDIO_ENCODING_ULINEAR_BE) {
    336 		if (precision == 16)
    337 			conv_func = change_sign16_be;
    338 		else if (precision == 32)
    339 			conv_func = change_sign32_be;
    340 		if (conv_func)
    341 			encoding = AUDIO_ENCODING_SLINEAR_BE;
    342 	} else if (encoding == AUDIO_ENCODING_SLINEAR_LE) {
    343 		if (precision == 16)
    344 			conv_func = change_sign16_swap_bytes_le;
    345 		else if (precision == 32)
    346 			conv_func = change_sign32_swap_bytes_le;
    347 		if (conv_func)
    348 			encoding = AUDIO_ENCODING_SLINEAR_BE;
    349 	}
    350 
    351 	/* if we can't express this as a Sun header, don't write any */
    352 	if (audio_encoding_to_sun(encoding, precision, &sunenc) != 0) {
    353 		if (!qflag && !warned)
    354 			warnx("failed to convert to sun encoding from %d:%d; "
    355 			      "Sun audio header not written",
    356 			      oencoding, precision);
    357 		conv_func = 0;
    358 		warned = 1;
    359 		return -1;
    360 	}
    361 
    362 	auh.magic = htonl(AUDIO_FILE_MAGIC);
    363 	if (outfd == STDOUT_FILENO)
    364 		auh.data_size = htonl(AUDIO_UNKNOWN_SIZE);
    365 	else
    366 		auh.data_size = htonl(total_size);
    367 	auh.encoding = htonl(sunenc);
    368 	auh.sample_rate = htonl(sample_rate);
    369 	auh.channels = htonl(channels);
    370 	if (header_info) {
    371 		int 	len, infolen;
    372 
    373 		infolen = ((len = strlen(header_info)) + 7) & 0xfffffff8;
    374 		*leftp = infolen - len;
    375 		auh.hdr_size = htonl(sizeof(auh) + infolen);
    376 	} else {
    377 		*leftp = sizeof(default_info);
    378 		auh.hdr_size = htonl(sizeof(auh) + *leftp);
    379 	}
    380 	*(sun_audioheader **)hdrp = &auh;
    381 	*lenp = sizeof auh;
    382 	return 0;
    383 }
    384 
    385 int
    386 write_header_wav(hdrp, lenp, leftp)
    387 	void **hdrp;
    388 	size_t *lenp;
    389 	int *leftp;
    390 {
    391 	/*
    392 	 * WAV header we write looks like this:
    393 	 *
    394 	 *      bytes   purpose
    395 	 *      0-3     "RIFF"
    396 	 *      4-7     file length (minus 8)
    397 	 *      8-15    "WAVEfmt "
    398 	 *      16-19   format size
    399 	 *      20-21   format tag
    400 	 *      22-23   number of channels
    401 	 *      24-27   sample rate
    402 	 *      28-31   average bytes per second
    403 	 *      32-33   block alignment
    404 	 *      34-35   bits per sample
    405 	 *
    406 	 * then for ULAW and ALAW outputs, we have an extended chunk size
    407 	 * and a WAV "fact" to add:
    408 	 *
    409 	 *      36-37   length of extension (== 0)
    410 	 *      38-41   "fact"
    411 	 *      42-45   fact size
    412 	 *      46-49   number of samples written
    413 	 *      50-53   "data"
    414 	 *      54-57   data length
    415 	 *      58-     raw audio data
    416 	 *
    417 	 * for PCM outputs we have just the data remaining:
    418 	 *
    419 	 *      36-39   "data"
    420 	 *      40-43   data length
    421 	 *      44-     raw audio data
    422 	 *
    423 	 *	RIFF\^@^C^@WAVEfmt ^P^@^@^@^A^@^B^@D<AC>^@^@^P<B1>^B^@^D^@^P^@data^@^@^C^@^@^@^@^@^@^@^@^@^@
    424 	 */
    425 	char	wavheaderbuf[64], *p = wavheaderbuf;
    426 	const char *riff = "RIFF",
    427 	    *wavefmt = "WAVEfmt ",
    428 	    *fact = "fact",
    429 	    *data = "data";
    430 	u_int32_t filelen, fmtsz, sps, abps, factsz = 4, nsample, datalen;
    431 	u_int16_t fmttag, nchan, align, bps, extln = 0;
    432 
    433 	if (header_info)
    434 		warnx("header information not supported for WAV");
    435 	*leftp = NULL;
    436 
    437 	switch (precision) {
    438 	case 8:
    439 		bps = 8;
    440 		break;
    441 	case 16:
    442 		bps = 16;
    443 		break;
    444 	case 32:
    445 		bps = 32;
    446 		break;
    447 	default:
    448 		{
    449 			static int warned = 0;
    450 
    451 			if (warned == 0) {
    452 				warnx("can not support precision of %d\n", precision);
    453 				warned = 1;
    454 			}
    455 		}
    456 		return (-1);
    457 	}
    458 
    459 	switch (encoding) {
    460 	case AUDIO_ENCODING_ULAW:
    461 		fmttag = WAVE_FORMAT_MULAW;
    462 		fmtsz = 18;
    463 		align = channels;
    464 		break;
    465 	case AUDIO_ENCODING_ALAW:
    466 		fmttag = WAVE_FORMAT_ALAW;
    467 		fmtsz = 18;
    468 		align = channels;
    469 		break;
    470 	/*
    471 	 * we could try to support RIFX but it seems to be more portable
    472 	 * to output little-endian data for WAV files.
    473 	 */
    474 	case AUDIO_ENCODING_ULINEAR_BE:
    475 		if (bps == 16)
    476 			conv_func = change_sign16_swap_bytes_be;
    477 		else if (bps == 32)
    478 			conv_func = change_sign32_swap_bytes_be;
    479 		goto fmt_pcm;
    480 	case AUDIO_ENCODING_SLINEAR_BE:
    481 		if (bps == 16)
    482 			conv_func = swap_bytes;
    483 		else if (bps == 32)
    484 			conv_func = swap_bytes32;
    485 		goto fmt_pcm;
    486 	case AUDIO_ENCODING_ULINEAR_LE:
    487 		if (bps == 16)
    488 			conv_func = change_sign16_le;
    489 		else if (bps == 32)
    490 			conv_func = change_sign32_le;
    491 		/* FALLTHROUGH */
    492 	case AUDIO_ENCODING_SLINEAR_LE:
    493 	case AUDIO_ENCODING_PCM16:
    494 fmt_pcm:
    495 		fmttag = WAVE_FORMAT_PCM;
    496 		fmtsz = 16;
    497 		align = channels * (bps / 8);
    498 		break;
    499 	default:
    500 		{
    501 			static int warned = 0;
    502 
    503 			if (warned == 0) {
    504 				warnx("can not support encoding of %s\n", wav_enc_from_val(encoding));
    505 				warned = 1;
    506 			}
    507 		}
    508 		return (-1);
    509 	}
    510 
    511 	nchan = channels;
    512 	sps = sample_rate;
    513 
    514 	/* data length */
    515 	if (outfd == STDOUT_FILENO)
    516 		datalen = 0;
    517 	else
    518 		datalen = total_size;
    519 
    520 	/* file length */
    521 	filelen = 4 + (8 + fmtsz) + (8 + datalen);
    522 	if (fmttag != WAVE_FORMAT_PCM)
    523 		filelen += 8 + factsz;
    524 
    525 	abps = (double)align*sample_rate / (double)1 + 0.5;
    526 
    527 	nsample = (datalen / bps) / sample_rate;
    528 
    529 	/*
    530 	 * now we've calculated the info, write it out!
    531 	 */
    532 #define put32(x) do { \
    533 	u_int32_t _f; \
    534 	putle32(_f, (x)); \
    535 	memcpy(p, &_f, 4); \
    536 } while (0)
    537 #define put16(x) do { \
    538 	u_int16_t _f; \
    539 	putle16(_f, (x)); \
    540 	memcpy(p, &_f, 2); \
    541 } while (0)
    542 	memcpy(p, riff, 4);
    543 	p += 4;				/* 4 */
    544 	put32(filelen);
    545 	p += 4;				/* 8 */
    546 	memcpy(p, wavefmt, 8);
    547 	p += 8;				/* 16 */
    548 	put32(fmtsz);
    549 	p += 4;				/* 20 */
    550 	put16(fmttag);
    551 	p += 2;				/* 22 */
    552 	put16(nchan);
    553 	p += 2;				/* 24 */
    554 	put32(sps);
    555 	p += 4;				/* 28 */
    556 	put32(abps);
    557 	p += 4;				/* 32 */
    558 	put16(align);
    559 	p += 2;				/* 34 */
    560 	put16(bps);
    561 	p += 2;				/* 36 */
    562 	/* NON PCM formats have an extended chunk; write it */
    563 	if (fmttag != WAVE_FORMAT_PCM) {
    564 		put16(extln);
    565 		p += 2;			/* 38 */
    566 		memcpy(p, fact, 4);
    567 		p += 4;			/* 42 */
    568 		put32(factsz);
    569 		p += 4;			/* 46 */
    570 		put32(nsample);
    571 		p += 4;			/* 50 */
    572 	}
    573 	memcpy(p, data, 4);
    574 	p += 4;				/* 40/54 */
    575 	put32(datalen);
    576 	p += 4;				/* 44/58 */
    577 #undef put32
    578 #undef put16
    579 
    580 	*hdrp = wavheaderbuf;
    581 	*lenp = (p - wavheaderbuf);
    582 
    583 	return 0;
    584 }
    585 
    586 void
    587 write_header()
    588 {
    589 	struct iovec iv[3];
    590 	int veclen, left, tlen;
    591 	void *hdr;
    592 	size_t hdrlen;
    593 
    594 	switch (format) {
    595 	case AUDIO_FORMAT_SUN:
    596 		if (write_header_sun(&hdr, &hdrlen, &left) != 0)
    597 			return;
    598 		break;
    599 	case AUDIO_FORMAT_WAV:
    600 		if (write_header_wav(&hdr, &hdrlen, &left) != 0)
    601 			return;
    602 		break;
    603 	case AUDIO_FORMAT_NONE:
    604 		return;
    605 	default:
    606 		errx(1, "unknown audio format");
    607 	}
    608 
    609 	veclen = 0;
    610 	tlen = 0;
    611 
    612 	if (hdrlen != 0) {
    613 		iv[veclen].iov_base = hdr;
    614 		iv[veclen].iov_len = hdrlen;
    615 		tlen += iv[veclen++].iov_len;
    616 	}
    617 	if (header_info) {
    618 		iv[veclen].iov_base = header_info;
    619 		iv[veclen].iov_len = (int)strlen(header_info) + 1;
    620 		tlen += iv[veclen++].iov_len;
    621 	}
    622 	if (left) {
    623 		iv[veclen].iov_base = default_info;
    624 		iv[veclen].iov_len = left;
    625 		tlen += iv[veclen++].iov_len;
    626 	}
    627 
    628 	if (tlen == 0)
    629 		return;
    630 
    631 	if (writev(outfd, iv, veclen) != tlen)
    632 		err(1, "could not write audio header");
    633 }
    634 
    635 void
    636 rewrite_header()
    637 {
    638 
    639 	/* can't do this here! */
    640 	if (outfd == STDOUT_FILENO)
    641 		return;
    642 
    643 	if (lseek(outfd, SEEK_SET, 0) < 0)
    644 		err(1, "could not seek to start of file for header rewrite");
    645 	write_header();
    646 }
    647 
    648 void
    649 usage()
    650 {
    651 	fprintf(stderr, "Usage: %s [-afhqV] [options] {files ...|-}\n", __progname);
    652 	fprintf(stderr, "Options:\n\t"
    653 	    "-C audio control device\n\t"
    654 	    "-F format\n\t"
    655 	    "-b balance (0-63)\n\t"
    656 	    "-c channels\n\t"
    657 	    "-d audio device\n\t"
    658 	    "-e encoding\n\t"
    659 	    "-i header information\n\t"
    660 	    "-m monitor volume\n\t"
    661 	    "-P precision bits (4, 8, 16, 24 or 32)\n\t"
    662 	    "-p input port\n\t"
    663 	    "-s sample rate\n\t"
    664 	    "-t recording time\n\t"
    665 	    "-v volume\n");
    666 	exit(EXIT_FAILURE);
    667 }
    668