People seem to have missed that he needs to be able to script this. That can be done with sox, where raw pcm can be generated from any input, the pcm can be edited with perl/tcl/ruby/whatever, and the results put back together using sox. It's not too hard to figure out HOW to do it, but it is going to be a bit of work for somebody.
Yeah, I guessed I missed that part. bj