text: The lightning comes first.  Lightning is 5 times hotter than the surface of the sun, so the air around it is superheated and expands rapidly, creating almost a vacuum.  As the lighning dissapates, the pressure around the area immediately fills the vacuum due to the great pressure gradient.  Whenever there is a sudden change in pressure, shock waves are created that make audible sounds.  Just as in a gun shot or a balloon popping, the sudden increase and decrease in pressure cause a loud shockwave that can be heard for miles.