Put a small lavalier microphone into the pipe of a stethoscope or to the end where the stethoscope is put into the ears. Record with a high quality recorder e.g. from company sounddevices. If you want to read a paper about "A simple electronic stethoscope for recording and playback of heart sounds" you can find it here: Anand Bhaskar (2012), A simple electronic stethoscope for recording and playback of heart sounds, Adv Physiol Educ 36: 360–362, 2012; doi:10.1152/advan.00073.2012. A link to the paper is attached.
Does that answer your question? Regards, Cornelius Poepel
Put the lavalier microphone cable plug into any digital audio recorder to the mic input. Then you have a digital audio signal of the sthetoscope. It might be helpful to learn about digital audio recording.