The Origins of Taps
This is the most generally-accepted version of the story
"Taps" is the most beautiful bugle call. Played slowly and softly, it has a smooth, tender, and touching character. It rolls down the curtains on the day or upon life whenever it is played or sung.
The origin of the bugle call Taps in its present form is generally attributed to Major General Daniel Butterfield who commanded a brigade in the US Army of the Potomac during the Peninsular Campaign of 1862, in the American Civil War. After a particularly hard fighting day as the weary troops settled down for the night along the James River near Richmond Virginia, the bugler sounded "Extinguish Lights" or what is more commonly called "Lights Out". On this night Butterfield felt that this bugle call was not as smooth, melodious, and musical as it should be. He felt that the day's final call should bring comfort and peace to tired troubled men. With the help of his bugler, Oliver W. Norton, Butterfield composed the music to what we know today as Taps.
Later in the Peninsular Campaign a funeral was being held during a lull in the fighting. The bugler was ordered to play Taps in place of the three volleys usually used to render the final honors to a deceased comrade. This was done because it was feared that rifle fire might cause the enemy to renew their attack. The playing of Taps was eventually written into Army regulations as a part of the honours to be paid at a military funeral.
While their are no official words to the bugle call itself, the commonly used lyrics are derived from the following verses:
Fading light dims the sight,
Day is done, gone the sun,
Then good night, peaceful night,
Thanks also for an explanation of the name "Taps" to USAF Master Sergeant Jari Villanueva of Washington DC - bandsman and researcher for the Arlington National Military Cemetery : I think we can take that as a pretty authoritative source! He says in an email answer to my query :
"The origin of the word Taps is thought to have come from the Dutch word for Tattoo or Taptoe. It was changed into the shorter Taps by soldiers. More than likely, the word Taps comes from the the three drum taps that were played as a signal for Extinguish Lights when a bugle was not used. The 3 drum taps were the last thing soldiers heard and it was the signal for all quiet. When the bugle call came into use and replaced the drum taps it took the name since it did the same thing-signaled for all quiet."
You can read his more detailed history of the tune on his West Point web page