mikelieman icon

Record a wav file from pulseaudio's analog stereo output

mikelieman | PRO | 02/24/16 07:13:39 AM UTC | 0 ⭐ | 648 👁️ | Never ⏰ | []
Bash |

390 B

|

None

|

0 👍

/

0 👎

#/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