Created
October 26, 2013 17:40
-
-
Save codingtony/7172372 to your computer and use it in GitHub Desktop.
record audio from :
http://www.outflux.net/blog/archives/2009/04/19/recording-from-pulseaudio/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WAV="$1" | |
if [ -z "$WAV" ]; then | |
echo "Usage: $0 OUTPUT.WAV" >&2 | |
exit 1 | |
fi | |
rm -f "$WAV" | |
# Get sink monitor: | |
MONITOR=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \ | |
grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1) | |
echo "set-source-mute ${MONITOR} false" | pacmd >/dev/null | |
# Record it raw, and convert to a wav | |
echo "Recording to $WAV ..." | |
echo "Close this window to stop" | |
parec -d "$MONITOR" | sox -t raw -r 22k -sLb 16 -c 2 - "$WAV" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment