I think what you're looking for is "Voice Activated recording", much like how a security camera with motion sensor works in that it starts recording when the input to the sound card is over a certain threshold, and pauses when things are silent.
There are also auto-started programs that can be set to start and stop recording at certain times, like a DVR.
There are a few out there, this is what I could find:
-ScanRec. The original website is down, but it's available from Softpedia, Software Informer, etc., just do a search for "Scanner Recorder" or "ScanRec", you'll find it. Only records to WAV format, but does have a buffer so it starts the audio recording from just before
the trigger, so you don't get clipping. Freeware
Same as above, don't know if it buffers though. Freeware
As requested, this runs in the background, listening for audio. Not free; $14.95 or ReCall-PRO for $29.95
Can run in the background.
Free, with a Pro version for way too much money, but apparently NASA used it.
Has both Timed Recording
and Sound-activated Recording
features. Free and Open Source.