End sox recording once silence is detected

view full story

http://unix.stackexchange.com – I'm writing a script that uses sox to record me talking. Now I need sox to wait until it detects sound before it begins recording, and I do have that figured out. But I also need sox to exit once there has been silence for at least 3 seconds. As it is now, I have to manually kill sox once I finish talking, otherwise sox just waits again until I talk some more, appending to the output file (That's not what I want). Here is the command for recording I am using now: rec /tmp/recording.flac rate 32k silence 1 0.1 3% -1 3.0 3% Again, just to be clear, Sox should wait until I start talking, and t (HowTos)