I mean, you can drop in 5.56 or even magnum rimfire rounds like 17HMR (anything that is supersonic past eg 200m) and that issue is mitigated. The swarms could hypothetically still detect muzzle flashes, so that could allow them to respond.
But the real issue is that the threat is a swarm, why are you taking potshots at it. Whatever weapon you use should be able to consume as many of them as possible at once.