Auto Mute microphone when computer plays sound through speakers

I have a tablet with builtin speakers and microphone. I'm using it for a voice recognition senerio, but when I ask it a question, the microphone picks up its answer, and it replies I don't understand over and over again until I mute the speakers.

Is there a program, or setting that will mute the microphone when audio is played through the speakers, then auto un-mute when its done?
 
Top