Actually, you speak in to the microphone, and the sound is converted to an electrical signal and stored by the tape recorder on magnetic tape, which can be played back.
This used to be the main method of practising to speak a foreign language, and 'language laboratories' were equipped with banks of these machines.