Ubunto 10.04 Gnome 2 nautilus.
First of all the script works fine in the terminal. The recording stops when I press CTRL-C or close the window. If I right-click in a folder and run the script, the file is created in that folder and the file size keeps increasing so I know it is recording. The problem is since there is no terminal to close and pressing Ctrl-C doesn't work I don't know how to stop the script when the music ends.
Here is the script. I need something at the end to keep Terminal open til I have recorded as much as I want. Then i can just press Ctrl-C or exit terminal to end my recording.
Code:
#!/bin/bash
# Copyright 2008-2009, Kees Cook <kees@outflux.net>
#
# Records the PulseAudio monitor channel.
# http://www.outflux.net/blog/archives/2009/04/19/recording-from-pulseaudio/
#
#This script require sox
#sudo apt-get install sox
if [ -n "$1" ]; then
OUTFILE="$1"
else
TIME=$(date +%d-%b-%y_%H%M-%Z)
OUTFILE="recording_$TIME.wav"
fi
# Get sink monitor:
MONITOR=$(pactl list | grep -A2 '^Source #' | grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
# Record it raw, and convert to a wav
echo "Recording. Ctrl-C or close window to stop"
parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - "$OUTFILE"
# End of soundcap.sh
Any help would certainly be appreciated!
Paul