Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # PulseAudio Recording Script
- #
- # Record sound output from PulseAudio
- # and convert it to something useful using sox
- #
- # Dependencies: pulseaudio, pacat (parec), sox
- #
- # Author: Michael Koch (Emkay443) (m<DOT>koch<AT>emkay443<DOT>de)
- # Version: 2013-08-31
- # License: GNU General Public License v3 (http://www.gnu.de/documents/gpl-3.0.en.html)
- ###################
- ## CONFIGURATION ##
- ###################
- # Sample rate in Hz
- sample_rate=44000
- # Number of bits (8/16/24)
- bits=16
- # Number of channels
- channels=2
- # Pulseaudio monitor device
- # Use "pacmd list | grep .monitor" and change the following value
- # according to the output of the above command (it has too look like in this example!)
- pulse_monitor_device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"
- #########################################################################################
- # WARNING: You should be careful when changing any code below. Modify at your own risk! #
- #########################################################################################
- ##################
- ## MAIN PROGRAM ##
- ##################
- if [ ! -z $1 ]; then
- echo "Recording Sound to $1"
- echo "Stop sound recording with CTRL-C"
- parec -d $pulse_monitor_device | sox -t raw -r $sample_rate -e signed-integer -L -b $bits -c $channels - $1
- else
- echo "This program requires one parameter - the file path of the converted file"
- exit 1
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment