Phonocardiography (PCG) signals provide valuable information about the heart valves .These auditory signals can be useful in the early diagnosis of heart diseases. Automatic heart sound classification has a promising potential in the field of heart pathology. In this research, a new method based on machine learning techniques is proposed for discriminating normal and abnormal heart sounds. In this method, first, the heart sounds are segmented into 4 main parts: S1, S2, systole and diastole segments. From these segments, statistical and time-frequency features are extracted for classification. Before classification, the distinctive features are selected using two approaches. In the first approach, the feature selection is accomplished using particle swarm optimization algorithm (PSO). In the second approach, we use Sequential Forward Feature Selection (SFFS) method. The proposed method was evaluated on the Physionet 2016 Challenge database using 10-fold cross-validation method. In this database, the number of normal and abnormal PCG signals are not balanced. Therefore, in this paper, the synthetic minority over-sampling technique (SMOTE) is applied to produce balanced data. The evaluation results showed that the proposed method can distinguish the normal heart sounds from abnormal ones with accuracy of 98/03% and sensitivity and specificity of 97.64%, 98.43%respectively.