Heart sounds play a crucial role in the clinical assessment of patients. Stethoscopes are used for detecting heart sounds and diagnosing potential abnormal conditions. However, several parameters of the cardiac sounds cannot be extracted by traditional stethoscopes. This paper presents a proposed algorithm based on peaks detection. Besides its ability of filtering the heart sounds signals, the time intervals of these sounds in addition to the heart rate were calculated by the proposed algorithm in an efficient way. Signals of the heart sounds from two sources were used to evaluate the efficiency of the algorithm. The first source was the data recorded from 14 participants, whereas the second source was the free data set sponsored by PASCAL. The algorithm showed different performance accuracy for detecting the main heart sounds based on the source of the data used in the study. The accuracy was 93.6% when using the data recorded from the first source, whereas it was 76.194% for the data of the second source.