Advertisement
mikelieman

Record a wav file from pulseaudio's analog stereo output

Feb 24th, 2016
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.39 KB | None | 0 0
  1. #/usr/bin/bash
  2.  
  3. # this is used in a regex for grep, so escape special chars ( periods )
  4. MON_SRC=analog-stereo\.monitor
  5.  
  6. if [[ -z ${1} ]]; then
  7.     echo -e "\nError: Missing output filename\nUsage: $(basename ${0}) filename.wav\n"
  8.     exit 1
  9. else
  10.     PA_DEV=$(pacmd list-sources | grep ${MON_SRC} | perl -ne 'print $1 if /\<(.*)\>/')
  11.     echo "Recording from ${PA_DEV} to ${1}"
  12.     parecord -v -d ${PA_DEV} ${1}
  13. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement