Music Genre Classification Using K-Nearest Neighbor and Mel-Frequency Cepstral Coefficients


  • Tika Pratiwi Universitas Amikom Yogyakarta
  • Andi Sunyoto Universitas Amikom Yogyakarta
  • Dhani Ariatmanto Universitas Amikom Yogyakarta




Music genre classification plays a pivotal role in organizing and accessing vast music collections, enhancing user experiences, and enabling efficient music recommendation systems. This study focuses on employing the K-Nearest Neighbors (KNN) algorithm in conjunction with Mel-Frequency Cepstral Coefficients (MFCCs) for accurate music genre classification. MFCCs extract essential spectral features from audio signals, which serve as robust representations of music characteristics. The proposed approach achieves a commendable classification accuracy of 80%, showcasing the effectiveness of KNN-MFCC fusion. Nevertheless, the challenge of overlapping genres, particularly rock and country, demands special attention due to their shared acoustic attributes. The inherent similarities between these genres often lead to misclassification, hampering accuracy. To address this issue, an enhanced feature engineering strategy is devised, leveraging deeper insights into the subtle nuances that differentiate rock and country music. Additionally, a refined KNN distance metric and neighbor selection mechanism are introduced to further refine classification decisions. Experimental results underscore the effectiveness of the refined approach in mitigating genre overlap issues, significantly enhancing classification accuracy for rock and country genres. This study contributes to the advancement of music genre classification techniques, offering an innovative solution for handling overlapping genres and demonstrating the potential of KNN-MFCC synergy in achieving accurate and refined genre classification.

GS Cited Analysis


Download data is not yet available.


Castillo, J. R., & Flores, M. J. (2021). Web-based music genre classification for timeline song visualization and analysis. IEEE Access,9,18801–18816.

Heakl, A., Abdelgawad, A., & Parque, V. (2022). A Study on Broadcast Networks for Music Genre Classification.

Qiu, L., Li, S., & Sung, Y. (2021). Dbtmpe: Deep bidirectional transformers-based masked predictive encoder approach for music genre classification. Mathematics, 9(5), 1–17.

Yang, R., Feng, L., Wang, H., Yao, J., & Luo, S. (2020). Parallel Recurrent Convolutional Neural Networks-Based Music Genre Classification Method for Mobile Devices. IEEE Access, 8, 19629–19637.

Mehta, J., Gandhi, D., Thakur, G., & Kanani, P. (2021). Music Genre Classification using Transfer Learning on log-based MEL Spectrogram. Proceedings - 5th International Conference on Computing Methodologies and Communication, ICCMC 2021, 1101–1107.

Liu, C., Feng, L., Liu, G., Wang, H., & Liu, S. (2019). Bottom-up Broadcast Neural Network For Music Genre Classification.

Allamy, S., & Koerich, A. L. (2021). 1D CNN Architectures for Music Genre Classification.

B. Liang, S. D. Iwnicki and Y. Zhao, "Application of power spectrum cepstrum higher order spectrum and neural network analyses for induction motor fault diagnosis", Mech. Syst. Signal Process., vol. 39, no. 1, pp. 342-360, Aug. 2013.

A. B. Nassif, I. Shahin, I. Attili, M. Azzeh and K. Shaalan, "Speech recognition using deep neural networks: A systematic review", IEEE Access, vol. 7, pp. 19143-19165, 2019.

S. A. Alodia Yusuf and R. Hidayat, "MFCC feature extraction and KNN classification in ECG signals", Proc. 6th Int. Conf. Inf. Technol. Comput. Electr. Eng. (ICITACEE), pp. 1-5, Sep. 2019.

Patrick Schneider, Fatos Xhafa, in Anomaly Detection and Complex Event Processing over IoT Data Streams, 2022

Sun, B., Chen, H.: A survey of nearest neighbor algorithms for solving the class imbalanced problem. Wirel. Commun. Mob. Comput. 2021.

Agarwal, Y., Poornalatha, G.: Analysis of the nearest neighbor classifiers: a review. Advances in Artificial Intelligence and Data Engineering: Select Proceedings of AIDE 2019, 559–570

Yuan, B.-W., Luo, X.-G., Zhang, Z.-L., Yu, Y., Huo, H.-W., Johannes, T., Zou, X.-D.: A novel density-based adaptive k nearest neighbor method for dealing with overlapping problem in imbalanced datasets. Neural Comput. Appl. 33(9), 4457–4481.2021

Jayaram Subramanya, S., Devvrit, F., Simhadri, H.V., Krishnawamy, R., Kadekodi, R.: Diskann: Fast accurate billion-point nearest neighbor search on a single node. Adv. Neural Inf. Process. Syst. 32 .2019


Crossmark Updates

How to Cite

Pratiwi, T. ., Sunyoto , A. ., & Ariatmanto , D. . (2024). Music Genre Classification Using K-Nearest Neighbor and Mel-Frequency Cepstral Coefficients. Sinkron : Jurnal Dan Penelitian Teknik Informatika, 8(2), 861-867.

Most read articles by the same author(s)