If you have a velocity sensitive piano or keyboard each key has 2 switches, it detects how hard the key has been pressed.  If you press it gently you get a quiet sound, if you hit it hard you get a louder sound.

The problem happens if you play with your general weight of play but some keys instead of being say 50% volume are at 100% or 20%, what is going on?

How does velocity sensitive volume work? 

So the 2 switches i mention are mounted at different heights on every key! the piano does a really clever thing of measuring how long it takes between the two switches being made.  If you brush the key lightly there will be a greater time between both switches being made, in contrast if you strike the key hard the switches make much quicker.   If however one switch fails, generally the piano will play the key at full volume.

How do i fix loud keys?

The switches are made up of strips of different key numbers depending on manufacturer, typically they're in octave splits, or upper and lower sets.  They're simply 2 little pieces of rubber carbon mounted within a very fine membrane frame, over time the membranes lose their shape or elasticity and cause breakdowns on the number of switches working.  

We recommend that if a few keys have gone, there is a good chance that the rest of the switches have had the same amount of wear and advise that we replace the entire keybed worth of membrane.  The cost for parts is minimal typically being no more than £6-10 per octave, the time and cost comes with stripping down the piano to the keybed and often involves removal of between 20 and 60 screws of different sizes!