Electronic Stethoscope: Sound Extraction, Processing and Analysis

DOI : 10.17577/IJERTV4IS060616

Download Full-Text PDF Cite this Publication

  • Open Access
  • Total Downloads : 809
  • Authors : Khalid Badi-Uz-Zama , Abhishek Attal, Abhijit Verma
  • Paper ID : IJERTV4IS060616
  • Volume & Issue : Volume 04, Issue 06 (June 2015)
  • DOI : http://dx.doi.org/10.17577/IJERTV4IS060616
  • Published (First Online): 25-06-2015
  • ISSN (Online) : 2278-0181
  • Publisher Name : IJERT
  • License: Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 International License

Text Only Version

Electronic Stethoscope: Sound Extraction, Processing and Analysis

Khalid Badi-uz-zama

Abhishek Attal

Abhijit Verma

IIT Kanpur

IIT Kanpur

IIT Kanpur

AbstractStethoscopehas always been primary instrument for diagnostics of large number of diseases. Different sounds produced inside the body may corresponds to different disorders like arrhythmia, breathing disorders and improper opening and closing of heart valves. In this paper, we report designing and fabrication of a device capable of extracting, processing, displaying and storing sound data gathered from the patients body with the help of chest piece diaphragm. The device is also capable of analyzing sound data and issuing warnings based on unhealthy heart rate patterns and murmurs.

KeywordsRaspberry Pi; Stethoscope; 3D printing; Heart rate disorders; Python; Sound Processing;


Physiological factors affecting the normal heart rhythm can be directly studied in relation with the Heart Rate variability (HRV). Many of the heart diseases are indicated in its non-stationary signals containing information about current or impending problems[1]. Hence, the disease diagnostics can be enhanced by the signal parameters of the heart rate variations obtained and analyzed computationally.

Such a diagnostics system not only allows to put patients under much longer watch, it also helps in training the new physicians in recognizing the heart rate patterns[2].A very important property of such a device is that it must be non-invasive. Matsubara et. al. have reported a device that can measure and diagnose cardiac and respiratory problems using a strain gauge[3]. Heart rate and Murmur sound produced by heart after systole or diastole can be used to detect problems like Bradycardia, Tachycardia, Sinus Arrhythmia and improper functioning of valves such as aortic stenosis, mitral regurgitation[4].

Doctors have used stethoscope to predict such indications on a primary level. But these indicators may not be present all time and may occur at intervals of few days[1]. Therefore, it requires a hand held device that can be kept by the patient and information collected over several days can be provided to the doctors. We have developed device that is portable, easy to operate and provides reasonably accurate data on the heart conditions.


The device was first designed on solid works to out on its outer appearance, size and ease of handling along with the proper fitting and assembly of the components. Figure-1 shows the design rendered from solid works software

Figure 1: Assembly design of the device created from Solid works

Raspberry Pi is a series of very small single board computer developed by the Raspberry Pi Foundation. The system uses a Broadcom BCM2835 System on Chip (SoC) which consists of ARM1176JZF-S 700MHz processor, VideoCore IV GPU, and 512MB of RAM. System runs on a Secure Digital memory card which contains Raspbian image (linux) as operating system. At 700MHz, the system does not get heated up enough to require an additional heat sink. This capability of Raspberry Pi B allows it to fit in a small space and puts it ahead of other alternatives such as ODROID series. Raspberry pi is powerful enough to be used for simultaneous data collection, cleaning, amplification, and recording. The device is self-sufficient in analyzing the data and warning the patient if peculiarities are found. Also, raw files can be extracted for consultations with the doctors. For obtaining the sound, we have used a sensitive stethoscope diaphragm in a chest piece which can pick the heartbeats as well as weak sound corresponding to breathing. A long tube carries sound from

the patient's body to the microphone, which is placed inside the device body. Figure-2shows the outer appearance of the device. Other contents of the device include TTL serial to USB converter due to the limitation of Raspberry-pi board. The final amplified and cleaned sound output can be taken on a headphone, which makes it easy for the doctors to listen and diagnose.

Since the device had to portable, we made the body of the device out of ABS plastic through 3-D printing, so that it remains light and handy.

Figure 2: Image showing the outer appearance of the device. Sound inputs are taken with the stethoscope diaphragm and any earphone can be connected for getting clean and amplified sound output.


A stethoscope chest-piece was directly used to capture the heartbeat and sound of lungs during breathing. The sound was then converted to electrical signals using a single channel microphone that gave input in .wav file format. Although the rubber tube served as a good insulator for the external sounds, some noises were still picked up by the microphone due to its high sensitivity. Also, the data stream contained the electronic noise of the microphone itself. In order to obtain proper results, a lot of sound processing was needed to be applied on the data obtained from the patient.


We used the python's 'wav' and 'audioop' modules to read the wav files generated. For testing purposes, we used audacity software to get an idea on the frequency ranges of the desired sound. The sounds inputs were taken in the frequency domain using the FFT function provided by python. All the frequencies other than desired frequencies were removed. To remove electronic noise produced by the microphone, sounds of frequencies outside the desired range of frequency were captured along with electronic noise and subtracted from the heart beat recordings, thus providing us with clean heartbeat data. Figure-3 shows the recorded sample in raw forms and after processing.


After noise removal, the sound gets amplified 25 to 50 times depending upon the requirement of the physician. To do that, we multiplied the time domain data to the amplification factor directly.


The wav file generated after noise removal and amplification gets plotted against time on the raspberry-pi screen. It can help the physician in visualizing the heartbeat pattern, frequency and time differences between the systolic and diastolic strokes. We have used the 'matplotlib' and 'scipy' libraries of python for plotting the wav files.

Figure 3: Time domain plot of the heart beats as raw data, amplified and after noise removal


When heard through stethoscope, a healthy heart gives two distinct sounds S1 and S2 corresponding to the mitral/tricuspid valves and aortic/pulmonic valves respectively. These valves open and close in order to maintain undisrupted supply of blood to the body and prevent it from returning back. In valvular disease condition, valves do not work properly and this can be detected from the murmur sound produced in between the systoles and diastoles. Murmurs of different types have been categorized in figure-5.

Heart problems associated with the opening and closing of the valves correspond to murmurs of characteristic sounds. We have first tried to isolated and analyze these murmurs in the software audacity[5]. Since we could not find any patient with the murmurs, we have incorporated murmur recognition techniques described by

  1. Tovar[6]and A. Haghighi[7].

    In our frequency domain analysis, we found that heart sounds are at low frequencies and hence digital noise reduction can be easily performed. Frequency domain of cleaned iles and raw files has been plotted in figure-4.








    Aortic Pulmonic Mitral Tricupsid Mitral Tricupsid Aortic Pulmonic

    Figure 5: Chart shows different types of murmurs that can be heard in the sounds when blood passes from one chamber to another in the heart.

    Figure 4: Frequency domain plot of the recorded sound before and after the noise removal. It shows the presence of noise of very high frequencies.

    Cardiac problems associated with heart rate can be diagnosed easily as it directly displays the beat count per minute. The bradycardia and tachycardia are the heart rate problems which can be diagnosed without the help of any device as they only require to count the beats. But, arrhythmia is difficult to diagnose, as it associated with the time gap between systole-diastole and diastole-systole cycles. W.W. Myint and B. Dillard have reported a method to recognize these cycles distinctly[4]. We take three consecutive sound peaks a, b and c and calculate the time difference between them as Ta-Tb and Tb-Tc and take their ratio (Ta-Tb) / (Tb-Tc). In normal heart condition, the systolic phase is smaller than the diastolic phase. Hence, this ratio calculation has been incorporated in the device for distinguishing the systolic and diastolic phases. Time gaps between these phases can give a good information about arrhythmia.

    Primary level sound matching has been incorporated in the device such that it can be trained to diagnose faults in the heartbeat sound. Doctors can feed in data corresponding to the diseased heart and healthy heart, so that system can later match the input with preloaded data files. To achieve this, we primarily focused on two techniques: frequency matching and Euclidean vector distance calculation.

    For frequency matching, the fast Fourier transform function of scipy module converts the time domain sound data into frequency domain sound data. After this conversion, the frequencies in the desired range can be directly matched with the frequencies present in the preloaded data along with their normalized amplitude.

    Another way of matching the sound files is by making vectors of small frames from files to be compared. The similarity of the sound is directly proportional to the distance between these two vectors and distance between them. This requires proper alignment of the frames to be compared. In case of this device, heartbeats overlap properly making it easier to align the frames. This technique is also used in audio fingerprinting for song

    matching in large data bases. For audio fingerprinting, the indexing technique used helps in quickly relating an audio file to its metadata by picking up key features. In our case, since the data base is not very big, we can apply direct frame matching as it will take O(N2) time for N total number of frames in both audio files.

    To our surprise, none of the techniques were not able to match our sample files to the audio files taken from Medscape [8]. We then normalized all the audio sounds to be compared and then matched them. The frequency amplitude matching technique gave reasonable results but the fingerprinting technique was found not to be suitable for this purpose. To detect murmurs, we took the reported murmur audio sound [8] and calculated its frequency spectrum. The frequency spectrum of the murmur sound is shown in figure-6. We looked for the signature hump of the murmur sound spectrum to diagnose the murmurs. Unfortunately, we did not had enough sample data to verify the murmurs.

    Figure 6: frequency spectrum of the murmur sound showing the characteristic hump at around 2000Hz.


    The device reported in this article can prove to be handy, not only for the patients in the absence of the doctors but also for the doctors who need training. Different algorithms and techniques of sound processing helps the patients to get warning and also makes it easier for the doctors to identify the problems. Cleaning noise from the sound and amplification make it easier for the doctor to identify the problem in the patient. The recording facility also helps in keeping track of the patients over a long period of time and keeping a watch on the phenomenon that occur rarely but are of great significance.


    We sincerely thank Dr. J. R. Kumar of Mechanical Engineering Department, IIT Kanpur for providing funds and valuable support to complete this project.


    1. Heart rate variability: a review; U. Rajendra Acharya, K. Paul Joseph, N. Kannathal, Choo Min Lim, Jasjit S. Suri; Med Bio EngComput (2006) 44:10311051

    2. Cardiac aucsultatory skills of internal medicine and family practice trainees; S. Mangione, L. Nieman; Journal of the American Medical Association,; vol. 278, pp 717-722, 1997

    3. Unconstrained and Noninvasive Measurement of Heartbeat andRespiration for Drivers Using a Strain GaugeA.Matsubara' and S.Tanaka; SICE ZOOZ Aug. 5- 7.2002

    4. An Electronic Stethoscope with Diagnosis Capability; Wah W. Myint, Bill Dillard, System Theory, 2001. Proceedings of the 33rd Southeastern Symposium; Mar 2001

      ; pp 133 – 137

    5. "Audacity: Free Audio Editor and Recorder".

      Audacityteam.org. Retrieved 5 January 2012.

    6. Graphicalrepresentation of heart sounds and murmurs; B. Tovar-Corona, J.N. Tony, Computers in Cardiology, 1997, pp. 101 104

    7. Time-frequency analysis of systolic murmurs; A. Haghighi-Mood, J.N. Tony; Computers in Cardiology, 1997, pp. 113 116

    8. AshvaryaMangla, MBBS, MD Chief Resident, Department of Internal Medicine, Weiss Memorial Hospital ; AshvaryaMangla, MBBS, MD is a member of the following medical societies: American College of Physicians and American Heart Association; http://emedicine.medscape.com/article/1894036

Leave a Reply