Prevent Clipping and Hum in class d amplifier


I got this amp. Now at large volumes, there seems to be clipping. Even though the amp is 20w, my speaker is rated for 25w.  How can I prevent it from happening, rather than never playing at high vol.

Can it be done by AGC or Dynamic Range Compression or Noise Gate.

In my case, which is a ready made pcb, how can I include such circuitry. Is it even possible.

Also, while selecting an IC, what needs to be looked at that will suggest clipping would not happen, or which parts needs to be referenced from the datasheet which ensures preventing clipping.

At large volumes, if I disconnect the mp3 player from the amp but keep the jack plugged into the amp, a high hum is heard. When removed, hum is lowered but not eliminated. Similarly, when track changes. What steps needs to be taken to eliminate them.

All the time before actually getting into practical electronics, I was only looking at Power output, THD+N, Class, etc of amplifier. It is only after going hands-on, for the first time, that I can experience the real things which most matter.

Appreciate for helping me become a pro.