There are actually three sounds - the gun firing, the rounds breaking the sound barrier, and the rounds impacting. Where you are relative to the plane and its target determines how they all mix together. In certain situations, you could hear all three distinctly, while in other situations you might hear them all at once. In most "gun run" videos, you hear the sonic booms and the impacts at about the same time, followed by the gun.