#!/bin/bash
################################################################################
# /usr/local/bin/audcap RM20071012
# a simple script for capturing audio straight off the soundcard.
# using kdialog and arecord. Figuring out which device you are copying 
# might be a pain in the keister but after you have it this is a handy
# little script to link to an icon on your desktop. 
################################################################################

# Nominate a place to put the recording
save_dir=/multimedia/audcap/

# Use a KDE dialog popup to get the duration of recording
# $duration is assigned the number entered in the kdialog box
duration=`kdialog --title "audcap" --inputbox "Enter The number of minutes to save audio:"`

# arecord times out after X seconds so convert minutes entered to seconds
time=$(($duration*60))

# Read the manpage to understand options.
# "-D hw:0,0" option refers to the # PCM device (on my soundcard) used 
# to capture the audio. Yours may be different.
# "-f cd" indicates a CD stereo quality format
# "`date +%g%m%d%H%M`.wav will provide a timestamp name for the wav file
arecord -d $time -D hw:0,0 -f cd $save_dir`date +%g%m%d%H%M`.wav

