Sometimes it comes as a surprise as a people to people when I tell them that every speaker is also a microphone. This is true because in a speaker you send in electrical signals to change the way a speaker cone moves. This in turn produces various sounds.
With the same setup, if one provides a mechanical vibration to the diaphragm, this will generate audio signals corresponding to that mechanical vibration.
We have made a video demonstrating this using a headphone jack and a phone. In order to loop the sound from the mic to the speaker in the video, we use the following command on Linux:
pactl load-module module-loopback latency_msec=1