In this study with the intent to segment phonocardiography (PCG) recordings, an algorithm that processes a feature vector obtained by jointly using wavelet transform and mel scaled energy spectrum of the PCG signal is proposed. The feature vector is processed by a peak detection algorithm which results in a set of peaks that meet some certain criteria and will be exploited in the succeeding stages of the algorithm. Heart sounds are labeled by convolving circularly a template and a fragment of the feature vector which is picked up with the guidance of the peaks. At the final stage, the algorithm tries to detect and correct erroneous labels. The performance of the algorithm was tested on both normal heart sounds and abnormal heart sounds; 80 records in total. As a result of these tests, for normal heart sounds S1 and S2 sounds were detected with 99,51% recall and 97,28% precision, while with 97,59% recall and 92,53% precision for abnormal heart sounds.