It is often stated that Thomas Edison was the first person to record sound and, by extension, music, but that isn't the case: the first ever recorded song was actually recorded by Édouard-Léon Scott de Martinville, a French printer and bookseller who also invented the phonautograph, the earliest known sound recording device.
Scott sang French folk song 'Au clair de la lune' into the phonautograph, which recorded the soundwaves of his voice and displayed them via a phonautogram, a sheet of lines that would visually recreate the patterns of the sounds that were picked up by the phonautograph. The recording was made on April 9th, 1860, but as the phonautograph could not play sound, only record it, the phonautogram of Scott singing was not listened to until its rediscovery in 2008. The phonautogram was converted into an audio file, and while initially scientists believed the recording to be a woman or child singing the song, they later discovered that the playback speed had been too fast, and when slowed down it revealed the recording to be that of a man's voice, likely Scott himself.
The discovery predated Edison's first musical recording by 20 years, and later more of Scott's phonautograms were discovered, one which also gave scientists the first ever recording of intelligible human speech.
Listen to the amazing, albeit thoroughly creepy, recording below.