This is similar to many other reactions humans have when scared, such as freezing, feeling like as if your heart is beating out of your chest, shaky legs, or the feeling that hair stands up on the back of your neck.
Fear starts with a trigger, and in your example, it is the sudden loud sound of the cannon. That stimulus signals to your brain that you might be in danger. Whether the stimulus is touch, sight, or sound, the scary signal quickly reaches the thalamus at the center of the brain and travels down to the amygdala, at the base of the brain.
From here a neurotransmitter called glutamate then carries the signal even deeper into the brain. This is what causes us to freeze, or involuntarily jump, and put humans through what is know as the "fight or flight" response.
These two reactions are automatic and involuntary because the deep brain is ancient in terms of evolution. We have little control over it. The reason is because a fight-or-flight response unleashes powerful hormones that affect the entire body.
When frightened, your body floods with the hormone adrenaline, skyrocketing your heart rate and blood pressure. The hormonal surge also causes your heart to pump blood more forcefully to the muscles. That's why you might feel a little shaky or unsteady when you're scared — the extra blood is getting your body ready to sprint away from the danger or stand and fight if you need to; hence the name fight or flight response.
Our bodies can reverse the fear response fairly quickly, though. If it turns out we aren't in a life-threatening situation, the parasympathetic nervous system (PSNS) kicks in to counter the fight-or-flight instinct, primarily by stopping the flood of adrenaline and lowering our heart rate back to normal. That's why every time we jump during a scary movie, or in your case a cannon sound, we don't run out of the theater/parade screaming; after the initial reaction, our PSNS helps us recognize the threat is not real and calms us down.
On a side note, part of the reason the PSNS exists is because adrenaline can actually be toxic in large amounts. If too much adrenaline floods into the heart, it can lead to the failure of that organ and death. You cannot control the fight or flight response, however you can limit it through meditation.
Hope that helps <3,