Subject: Re: using audiorecord(1)?
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 04/06/2001 20:38:37
On Sat, 7 Apr 2001, Martin Ammermueller wrote:

> Jeremy C. Reed wrote:
> > Can anyone share some examples of using audiorecord(1)?
> 
> Sure:
> 
> [martin@Nike]~>audiorecord test.wav
> ^C[martin@Nike]~>

That is too easy :)

And audiorecord is broken (or the manual page is wrong).

$ uname -a
NetBSD rainier 1.5.1_ALPHA NetBSD 1.5.1_ALPHA (JCR-1.5-20010108) #0: Mon
Jan  8 09:25:45 PST 2001
reed@rainier:/usr/src/sys/arch/i386/compile/JCR-1.5-20010108 i386
$ ident /usr/src/usr.bin/audio/record/record.c
/usr/src/usr.bin/audio/record/record.c:
     $NetBSD: record.c,v 1.10 2000/02/02 05:02:25 dmcmahill Exp $

(From looking at newest code in CVS, the problems still exist.)

$ audiorecord J
.snd @

followed by a bunch of junk

vis -o says:
ggggggg\377\377\377\377\377\377\377\377\377\377\377

\377 is a y with an umlaught above it.

So instead of saving to J it just dumps to the screen.
One character filenames do not work.

        /*
         * open the output file
         */
        if (argc != 1)
                usage();
        if (argv[0][0] != '-' && argv[0][1] != '\0') {
                outfd = open(*argv, O_CREAT|(aflag ? O_APPEND : O_TRUNC)|O_WRONLY, 0666);

It should use strncmp or something else to check this. It shouldn't assume
filenames can't be one character long.

Also:
$ audiorecord >J
Usage: audiorecord [-afhqV] [options] {files ...|-}
...

The manual page says: "The audiorecord program copies the audio devices to
... the standard output if no file is named." But the code indicates it
needs a "-" dash to mean stdout.

Your example does work for me. Also "audiorecord J > J" works.

Any comments before I send-pr these two problems?

   Jeremy C. Reed
   http://www.reedmedia.net/