How to make this program like a clap/snap fingers switch, and filter out all excess noise?

the model of the sound sensor

schematic: