Quick answer: Pygame mixer.set_num_channels called rapidly produces audio pops? Channel reallocation interrupts audio streams - cap channel count once at init.

Dynamic channel adjustment in long sessions; periodic pops correlate with adjustments.

Set once at init

Max channels at startup; don't change. Eliminates the disruption.

Or fade before change

Fade out; change; fade in. Pop hidden.

Pool channels

Pre-allocated max; managed via your code. Engine doesn't reallocate.

“Channel allocation is disruptive. Avoid changing.”

If you adjust channels at runtime, the once-at-init pattern is the safer alternative.

Related reading