How to play music on PAM8610 with ESP32?
Both amplifiers use an input coupling capacitor to block DC from your esp32.
The datasheet for the PAM8610 shown a maximum input of -0.3V to +6V and since it needs an input coupling capacitor its input is probably already biased at +3V. It uses a DC volume control that your amplifier module does not use. Its inputs are line level. 

The datasheet for the PAM8403 shows a maximum input of -0.3V to Vdd PLUS 0.3V so the input  voltage range is almost the same as the PAM8610.

The PAM8610 produces 5W to 8W per channel at low distortion into 8 ohm speakers when the supply is +12VDC. The IC will overheat when driving 4 ohm speakers.