30/11/2002 @12:03:36 ^12:37:10

Yesterday, despite the fact that I pretty much know the relevant commands and the necessary options, I made the following script, saved under the filename "radioshow". It is hereby placed into the public domain. Go nuts.

# radioshow, by RjY of anARCHy. All rights given away. Do what you like.
# records and encodes an MP3 for a specified time (uses sox(1), lame(1))
# Makes recording certain radio programmes easier, hence the name

# check command line and set some alias variables for clarity
[ $# -ne 2 ] && { echo "Syntax: $0 <time> <filename>"; exit 1; }
RECTIME=$1 # time to record for, just a parameter to sleep(1)
RECFILE=$2 # name of the file to record to, this should end with ".mp3"

# say what we're doing (if using at(1) this will turn up in your email)

# start off the recording and encoding processes (might need customising)
sox -t ossdsp -r 48000 -wsc2 /dev/dsp -t raw - \
	| lame -rxts48 - ${RECFILE} &
# sleep for the recording time, then kill the background process group
sleep ${RECTIME} ; kill -TERM $!

Actually I should say that your mileage might vary. Why? There's some funny options in there, you know. I still don't know why I have to use -x with lame, but if I don't I just get static. Probably some compile-time option I got wrong, oh well. I wrote about this ages ago.

PS It would seem that you don't have to type &amp; any more when you want an ampersand! & will do, it doesn't break the redesigned HTML validator.