We’ve already given you the basics about how fireworks are able to get to be just about any color you can find in a Crayola box (save for those vivid blues), and how they manage to blow up into ooooh- and aaaaah-worthy shapes. But what about the basic mechanism that makes fireworks go boom, other than a spark from the American Spirit your half-drunk stepdad is puffing? Gigantic explosions in the sky, at just the right time, require a small miracle of timing and precision. Here’s how that happens.

To get maximum patriotic satisfaction, fireworks technicians must secure two basic but complicated steps: propelling the fireworks shell to the correct height and making sure it bursts into its predetermined shape while it’s hanging out hundreds of feet in the air.

To launch the shell, the fireworks go in mortar tubes, roughly the premise behind the Howitzers you’ll see in war movie marathons on AMC this week. The tubes are usually buried in the ground to absorb the kick of the shell; to get the thing moving, technicians lay a bed of gunpowder below the main shell. A fast-acting fuse ignites the powder with an electric charge called a squib, releasing a huge amount of energy inside the mortar. The heat and gas from that buildup creates pressure that forces the shell out of the mortar like a bullet from a gun.

At this point, shouldn’t an increase in fiery energy cause the whole flammable mass to blow up before it gets off the ground? Not quite.

The compact shell protects the pyrotechnics enough not to explode at ground level, while a second timed fuse inside allows a second ignition of the shell’s black powder to produce more outward heat energy and gases during its brief flight. This allows the recipe of chemicals inside to eventually create the multi-colored skyward bursts all the half-pickled Independence Day revelers have been eagerly awaiting.

After the first two steps are over, here comes the thud, the crack of the firework that rings your ears and punches your chest. This roar is actually a sonic boom: the product of the compact expulsion of energy from the shell expanding faster than the speed of sound. More powder means more bang, which in fireworks parlance is called a “report.”

Technicians have a range of loud sounds at their disposal. “Other noises such as whistles and crackling effects are specific chemical reactions triggered by heat and gas at very high pressures in the fireworks shell,” is how Julie Heckman, the executive director of the American Pyrotechnics Association, put it to me. This essentially makes a firework a big chemically complicated grenade that blows up hundreds of feet in the air. Somewhere, perched on a pick-up, a bald eagle watches and sheds a single tear.