The phonograph, invented by Thomas Edison in 1877 (patented 1878), was the first device to both record and reproduce sound.
Before the phonograph, music was exclusively live. Edison's machine decoupled performance from presence, birthing the recording industry. Later improvements (wax cylinders, flat discs by Berliner) commercialized the medium, but the 1877 tinfoil prototype was the breakthrough.