1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
#!/bin/sh
# Shell script to record sound files from unix style sound devices.
# Should auto detect most supported systems and record the file for you.
#
# Originally developed by Chris Bagwell (cbagwell@sprynet.com)
#
# Change History:
#
# June 1, 1998 - Chris Bagwell (cbagwell@sprynet.com)
# Kjetil Torgrim Homme <kjetilho@ifi.uio.no> sent in a neat patch to
# attempt an educated guess on how to rec sound on sun hardware.
# There is probably a better way to do it in the actual software though.
#
# Use the parsed out volume flag to have sox change the volume. Yes, its
# better to use the audio devices hardware mixer to adjust volume but some
# way is better then no way. Its still parsed seperately so people may
# optionally pass the parameter to a mixer.
#
# September 7, 1998 - Chris Bagwell (cbagwell@sprynet.com)
#
# Updated usage checking a little more so that only one filename can
# be given.
#
# January 9, 1999 - Chris Bagwell (cbagwell@sprynet.com)
#
# Quoted $filename so that files with spaces in their names can
# be given.
# Arnim Rupp patch file to work with multiple sound devices via
# command line option.
#
# Set up path so that it can find Sox if user's path doesn't already
# include it.
PATH=$PATH:/usr/local/bin
export PATH
help()
{
echo "rec v1.5 - front end to Sox"
echo ""
echo "Usage: rec [ fopts ] outfile [effects]"
echo
echo "fopts: -c channels -d device -h -r rate -t type -v volume -s/-u/-U/-A -b/-w/-l/-f/-d/-D -x"
echo
echo "effects: avg/band/chorus/copy/cut/deemph/echo/echos/flanger/highp/lowp/map/mask/phaser/pick/polyphase/rate/resample/reverb/reverse/split/stat/vibro"
echo ""
echo "See sox man page for more info on required effects options."
}
if [ "$1" = "" ] ; then
help; exit 1;
fi
while [ $# -ne 0 ] # loop over arguments
do case $1 in
avg|band|chorus|copy|cut|echo|echos|flanger|highp|lowp|map|mask|phaser|pick|pred|rate|resample|reverb|reverse|split|stat|vibro)
effects="$@"
break
;;
-c)
shift
fopts="$fopts -c $1"
;;
-d)
shift
device="$1"
;;
-h)
help;
exit 1;
;;
-r)
shift
fopts="$fopts -r $1"
;;
-t)
shift
fopts="$fopts -t $1"
;;
-v)
shift
volume="-v $1"
;;
-)
filename="-"
;;
-*)
fopts="$fopts $1"
;;
*)
if [ "$filename" = "" ]; then
filename="$1"
else
echo "Filename already give. Ingoring extra name: $1"
fi
;;
esac
shift
done
arch=`uname -s`
echo "Send break (control-c) to end recording"
if [ "$arch" = "SunOS" ]; then
if [ "$device" = "" ]; then
device="/dev/audio"
fi
case `arch -k` in
sun4|sun4c|sun4d)
# Use below for older Sun audio hardware
sox $volume -t sunau -U -c 1 $device $fopts "$filename" $effects
;;
*)
# Use below for newer Sun audio hardware that supports stereo linear
sox $volume -t sunau -w -s $device $fopts "$filename" $effects
;;
esac
else
if [ "$arch" = "Linux" ]; then
if [ "$device" = "" ]; then
device="/dev/dsp"
fi
# Possible way to set volume
# if [ "$volume" != "" ] ; then
# mixer $volume
# fi
sox $volume -t ossdsp $device $fopts "$filename" $effects
fi
fi
|