Play sound when the mic is opened or closed

App Inventor itself can't do it and I do not know, if we already have an extension, which is able to do this?

Here is a snippet to detect, if the microphone is available

If there is no extension already available to detect this, you could write your own extension to do so...

more information about how to create an extension see the App Inventor Extensions document
however that will be more advanced and will require some Java skills...

And then execute that check in the background... To do that, you have to get familiar with itoo first

Taifun