Record a wav file from pulseaudio's analog stereo output
#/usr/bin/bash
# this is used in a regex for grep, so escape special chars ( periods )
MON_SRC=analog-stereo\.monitor
if [[ -z ${1} ]]; then
echo -e "\nError: Missing output filename\nUsage: $(basename ${0}) filename.wav\n"
exit 1
else
PA_DEV=$(pacmd list-sources | grep ${MON_SRC} | perl -ne 'print $1 if /\<(.*)\>/')
echo "Recording from ${PA_DEV} to ${1}"
parecord -v -d ${PA_DEV} ${1}
fi
Comments