What’s with Lieutenant Gaeta’s whole singing thing after he loses his leg?

He’s among my favourite characters and had one of the best character arcs but I never understood that whole singing bit.