Thanks Chuck. I'll try this out. Greg On Fri, Mar 29, 2002 at 04:55:15PM -0500, Charles Hallenbeck wrote: > Greg - > Your example showed that you did not use any parameters with the > arecord command at all. No wonder it did not work! > > I will include below a script which I use to record wav files but > first I will talk about it. > > The script contains some statements that let you use "ctrl-c" to > interrupt a running program without interrupting the script > itself. The reason is that I want to run arecord for an > indefinite amount of time and interrupt it when the work is done, > but I want the script to continue. > When the recording is complete, I want to use sox to copy it to > my home directory from the /tmp directory where it was created, > so that sox can fix the length parameter in the RIFF header as a > by-product. > The script is called "rec22km" which means 22k sampling rate and > mono format. I have other scripts for 22k stereo and other > speeds, Mono and stereo. All the scripts produce 16 bit signed > samples. > The script can be run just by typing the script name, in which > case the resulting file in your home directory will be > "rec22km.wav", or you can include a name such as "myvoice" on the > command line: "rec22km myvoice" and the resulting file in your > home directory will be called "myvoice.wav". > Once the copying is complete, the file is played just for kicks, > and to verify that it worked. You can also interrupt the play > command with ctrl-c and the script survives so that it can remove > the /tmp file before exiting. > > The parameters on the arecord command are what you have failed to > include. I use "-d 7200" to allow a ridiculously long duration. > This parameter was optional in earlier versions, but somewhere > along the way the default duration became "0 seconds" so you have > to give it a positive value. > I use "-q" to throw away the reporting messages. > I use "-r 22050" to set the sampling rate. > I use "-f S16_LE" to specify the format of the output file: > S16_LE means "signed 16 bit little endian". This parameter has > changed regularly with each upgrade and is a pain in the ass to > keep track of when you upgrade. > I use the "-c1" parameter to specify one channel (i.e., monaural) > and a space between the 'c' and the '1' is permitted but not > required. > Finally comes the file name. > The trailing ')' on the arecord line of the script below belongs > to the subshell interruption control from the previous line. > > Sorry this has been so complicated, but once you get it going it > works like a charm. Of course you must be sure you have enable > 'capture' on the input source you want to record (you cannot just > set your speaker level, since that is not the signal that gets > recorded). For example you would want to mute your mike channel > or turn the speaker volume off, but enable capture on the mike > channel and adjust the capture volume appropriately. I have to > use different capture volume settings for mike, CD, and Line, but > once they are set, arecord works like a charm for me. > > Here is the script: > ------------- > #!/bin/bash > trap "" SIGINT # ignore ^C > (trap - SIGINT # except in this subshell > arecord -d 7200 -q -r 22050 -f S16_LE -c1 /tmp/rec22km.wav ) > echo wait... > if [ "$1" = "" ]; then > sox /tmp/rec22km.wav rec22km.wav >/dev/null 2>&1 > echo rec22km.wav > (trap - SIGINT # except in this subshell > play rec22km.wav ) > else > sox /tmp/rec22km.wav $1.wav >/dev/null 2>&1 > echo $1.wav > (trap - SIGINT # except in this subshell > play $1.wav ) > fi > rm /tmp/rec22km.wav > /dev/null 2>&1 > ------------- > > HTH - Chuck > > > > Visit me at http://www.valstar.net/~hallenbeck > The Moon is Waning Gibbous (98% of Full) > > > _______________________________________________ > Speakup mailing list > Speakup at braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup