Audio on ESP32: PDM microphone and MAX98357A speaker
The amplifier runs off the battery, not the regulator.

Summary
- Two I2S peripherals: one for the microphone, one for the speaker.
- PDM microphone on IO41 and IO42. Speaker over I2S on IO6, IO7 and IO8.
- Recording and playback don't compete.
- MAX98357A: 3 dB gain with 100k from GAIN to VIN.
- First test: record 3 s of voice and play it back.
«The amplifier goes to the battery, not the regulator. Audio peaks don't ask permission.»
The math · Power into 8 Ω
- 3.7 V: ~0.93 W at 10 % THD · 0.77 W at 1 %.
- 5 V: 1.8 W at 10 % · 1.4 W at 1 %.
- 4.2 V isn't in the table.

Engineer's rule
Power stages run off the battery. Logic runs off the regulator.