Supersonic rounds make a distinctive noise that machines could reliably distinguish from fireworks (humans can learn to do this too). But distinguishing arbitrary subsonic ammo vs. arbitrary fireworks seems like it would be at least an order of magnitude harder & I don't think it could be made 100% reliable