Physics is against you on this one.
Muzzle blast (which is the precursor event) is caused by the expulsion of a fairly large amount of high-pressure gas at very high speed. Any cancelling impulse will require the production of a similar event, but with negative pressure, in effect producing a transient vacuum. Furthermore, the amplitude of the vacuum is fixed (at zero pressure, obviously) while the muzzle blast has no obvious upper limit.
Finding out the peak overpressure of a rifle or pistol muzzle blast does not seem to be easily done on the internet, but here is an amateur attempt which suggests a peak muzzle pressure on the order of 5700 psi, or about 387 atmospheres. This would seem to indicate that you'll need a vacuum volume equivalent to 387 times the size of the gas bubble emerging from the muzzle. This will also require addressing the pressure wave produced by ignition of unburned propellant after it is expelled from the barrel (muzzle flash).
In effect, you'd need rather a large array of speakers very close to the muzzle which would operate to produce a local vacuum which would be filled by the muzzle gases, and I'm not at all certain how to this, or even if it's possible. The rate of pressure decrease produced by the speakers would very high (high frequency response) at the same time that the volume displaced would also be very large, and the two requirements are entirely antagonistic in normal speaker design. Subwoofers move a lot of air, but not at high frequencies.
If you're willing to set up your speakers as a shell at some large distance from the weapon, the idea seems technically feasible, but such a speaker array would draw a whole lot of attention to the presence of the shooter, which seems unlikely to be desireable. Plus, of course, it would not exactly be very portable.