Analysis of heart sound signals plays an essential role in preventing and diagnosing cardiac diseases. This study proposes a multi-level feature encoding algorithm based on frequency-balanced power spectral intensity for heart sound signal classification. Firstly, a wavelet threshold function is employed to denoise the heart sound signals. Then, the frequency-balanced power spectral intensity envelope is calculated, and an encoder is utilized to extract multi-level features based on the envelope. Finally, an ensemble bagging tree classifier is selected for classification. The experimental data includes binary classification data from the 2016 PhysioNet/CinC Challenge and ternary classification data from the self-collected hypertrophic cardiomyopathy dataset. Results demonstrate that the proposed algorithm performs well, achieving an average classification accuracy of 98.73% for normal and abnormal heart sounds, and 98.12% for normal and two types of hypertrophic cardiomyopathy heart sounds. The proposed method holds significant reference value for the early diagnosis of heart diseases.