Well, it turns out it was an accident.
In 1860, the French printer and inventor Édouard-Léon Scott de Martinville sang a famous folk song, ‘Au Clair de la Lune’, into his recent invention: the Phonautograph. It recorded the soundwaves of his voice and displayed them as a sheet of lines which were visual representations of his voice.
He did not realize it could be played back, however, and his recording would not be heard until 150 years later.

What is a Phonautograph?
In 1857, Édouard-Léon Scott de Martinville invented the Phonautograph. The machine was an attempt to “build an artificial ear”, explains audio historian Patrick Feaster. The device consists of a cone-shaped horn with a diaphragm at one end connected by a manual crank. When Édouard-Léon spoke into the machine, the cone would receive the sound waves and they would be etched onto paper which was blackened by soot from an oil lamp.
The French inventor would never make much money from his groundbreaking discovery in audio and music. He sold a handful of his devices to various scientific labs where they would continue to study sound. Édouard-Léon, for all his work, lived the rest of his life as a humble bookseller.

Édouard-Léon’s primary objective was to create a machine through which he could study sound from a visual perspective. He did not mean to create one which played back sounds and did not know that his recordings would ever be heard 148 years later.
How was the recording discovered?
In 2008, the New York Times announced an important discovery. They reported that, through IRENE technology which was pioneered at Berkeley’s National Laboratory, they’d translated the etchings into listenable audio. This made Édouard-Léon’s singing the first song ever recorded, as well as the first recorded voice and sound.
Initially, the scientists did not think this was Édouard-Léon’s voice. It was only when revisiting the project in 2010, realizing its significance, that they discovered a miscalculation. Originally, they thought they were hearing the voice of a child or woman, due to its high pitch, tempo, and almost ghostly sound. Édouard-Léon, they discovered, had sung the song unexpectedly slowly and then sped up the recording.
For a long time, researchers believed that Thomas Edison’s wax cylinder phonograph was the first ever recorded sound. Édouard-Léon’s rendition of ‘Au Clair de la Lune’ predated Edison by 30 years.