"Face the music"

To “face the music” means to be confronted with the unpleasant consequences of one’s actions. How did that meaning come about? What music is it referring to?

That’s from here about halfway down the page. A quick look around google turns up pretty much the same results.

This site has a little more detail:

Could the possible military origin be taken a step further? I’m thinking of a drumbeat or other music, accompanying a firing squad.

This was my thought also, but I think I may have gotten the idea from old movies.

There is also a line in Starship Troopers, the book, not the movie or the song, where there is an execution of a deserter. Heinlein alludes to the execution by saying “they played the (some song title like Danny Deever)”. My memory is failing me. Does anyone else recall this passage?

Google is my friend.

It is Danny Deever, and it’s a Kipling reference. In the poem, Kipling references playing the Dead March. And that’s what I’ve always taken “face the music” to mean.