How can I detect that sound is being generated
I don't know of any way to react to sound output in software, but:

This could be done as a stand-alone hardware device reasonably straightforward. I didn't find any ready-made products, but it wouldn't be too hard for any electronics hobbyist with some analog experience, I think (here's a design I found, for example; it could probably also be done with a single microcontroller, especially if the amplifier has an IR remote control). Let me know if you'd like me to expand on this possibility...