
Heh, a few years ago I wrote a wxPython program to make recordings and play them back (although only in mono, not stereo).
It's a bit ugly, with hardcoded constants from the kernel header files, but it should still work. I can't really help with splitting the channels, or with any signal processing for detecting silence, but I can help with changing the default settings of the oss device. (This assumes that if you are using alsa, you have the old-style oss emulation.)
Here are the relevant bits from my python script.
Yeow, that's complicated! I managed to dig up some more stuff on google, I think I have the parameters set correctly now and I was planning to use aumix to select the input and set levels. I also discovered there's a wave module which should take care of the wave headers for me.. This is what I have so far; -- #!/usr/bin/python -O import string,sys,re,wave,ossaudiodev from string import * from time import * from commands import getoutput fmt=ossaudiodev.AFMT_S16_LE channels=2 rate=44100 dsp=ossaudiodev.open("/dev/dsp",'r') (fmt, channels, rate) = dsp.setparameters(fmt, channels, rate) def listen(howmuch): chunk = dsp.read(howmuch) return chunk -- Now I'm guessing that if I call dsp.read(176400) I should get one second of signed 16 bit audio data in the form "[left low] [left high] [right low] [right high]", I should then jump into a loop parsing this into 16 bit integers and seeing if they exceed some threshold value. Or is there a cleaner way of doing dsp.read so that it returns some sort of pre-formatted structure?