Penerapan Algoritma Random Forest dalam Prediksi Emosi Musik Berdasarkan Karakteristik Fitur Audio Spotify

Main Article Content

Nabila Defany Marsya
Muhammad Mufrih Munadhil
M Alvin Dzakyananta
Khusnatul Amaliah
Dani Rofianto

Abstract

Emotion classification in music is a crucial aspect in developing context-aware recommendation systems that respond to the listener’s mood. The Random Forest algorithm is used to map song emotions based on Spotify audio features, namely valence, energy, loudness, and danceability, which reflect the psychological and acoustic aspects of music. The dataset was collected through the Spotify Web API and public repositories, consisting of songs released between 2009 and 2019. Data processing involved normalization and labeling emotions into five categories: Angry, Calm, Happy, Neutral, and Sad. The model was trained using 70% of the data and tested with the remaining 30%. Evaluation results showed an accuracy of 98.75%, with perfect F1-scores for the Happy and Sad categories. Valence and energy were found to be the most influential features, while Calm was often confused with Neutral due to similar acoustic patterns. These findings demonstrate that the Random Forest approach is effective in accurately and consistently classifying music emotions based on audio features.

Article Details

Section
Articles

References

R. Liyanarachchi, A. Joshi, E. Meijering, (2025), “A Survey on Multimodal Music Emotion Recognition”, ACM Comput Surv, 2025.

J. Kang, D. Herremans, (2025), “Towards Unified Music Emotion Recognition Across Dimensional and Categorical Models”, 2025.

Z. Hilal, K. Ülkü, B. Ayhan, (2025), “Evaluating Raw Waveforms With Deep Learning Frameworks for Speech Emotion Recognition”, 2025.

Y. Xia, (2022), “Study on Music Emotion Recognition Based on the Machine Learning Model Clustering Algorithm”, 2022. https://doi.org/10.1155/2022/9256586

G. Yoo, S. Hong, H. Kim, (2024), “Emotion Recognition and Multi-class Classification in Music with MFCC and Machine Learning”, Sensors, vol. 14, no. 3, pp. 818–825, 2024.

F. Abri, L. F. Gutiérrez, P. Datta, D. R. W. Sears, A. S. Namin, K. S. Jones, (2021), “A Comparative Analysis of Modeling and Predicting Perceived and Induced Emotions in Sonification”, pp. 1–22, 2021.

L. Cai, S. Ferguson, H. Lu, G. Fang, (2022), “Feature Selection Approaches for Optimising Music Emotion Recognition Methods”, pp. 9–27, 2022. https://doi.org/10.5121/csit.2022.122302

N. Falah, B. Yousefimehr, M. Ghatee, (2025), “Predicting Music Track Popularity by CNN on Spotify Features and Spectrogram”, 2025.

P. L. Louro, H. Redinho, R. Malheiro, R. P. Paiva, R. Panda, (2024), “A Comparison Study of Deep Learning Methodologies for Music Emotion Recognition”, Sensors, vol. 24, no. 7, pp. 1–17, 2024. https://doi.org/10.3390/s24072201

P. Álvarez, J. G. de Quirós, S. Baldassarri, (2023), “RIADA: A Machine-Learning Based Infrastructure for Recognising the Emotions of Spotify Songs”, IJIMAI, vol. 8, no. 2, pp. 168–181, 2023. https://doi.org/10.9781/ijimai.2022.04.002

F. Lv, H. Wang, (2025), “Multi-channel Enhanced Graph Convolutional Network for Sentiment Analysis on Instrumental Music Descriptions”, Alexandria Engineering Journal, vol. 124, pp. 527–539, 2025. https://doi.org/10.1016/j.aej.2025.03.088

X. Hao, H. Li, Y. Wen, (2025), “Real-time Music Emotion Recognition Based on Multimodal Fusion”, Alexandria Engineering Journal, vol. 116, pp. 586–600, 2025. https://doi.org/10.1016/j.aej.2024.12.060

E. Mardiani et al., (2023), “Penerapan Algoritma Supervised Learning untuk Klasifikasi Data Music Listening”, MALCOM, vol. 3, no. 2, pp. 115–124, 2023. https://doi.org/10.57152/malcom.v3i2.879

M. E. İsenkul, (2025), “Optimizing the Sentiment Recognition in Spotify Playlists Through Ensemble-Based Approaches”, Acta Infologica, pp. 1–16, 2025.

S. S. Gujar, A. Y. Reha, (2024), “Enhancing Accuracy and Performance in Music Mood Classification Through Fine-Tuned Machine Learning Methods”, CANA, vol. 31, no. 5S, pp. 234–258, 2024. https://doi.org/10.52783/cana.v31.1019

S. Hizlisoy, S. Yildirim, Z. Tufekci, (2021), “Music Emotion Recognition Using Convolutional LSTM DNN”, Engineering Science and Technology, vol. 24, no. 3, pp. 760–767, 2021. https://doi.org/10.1016/j.jestch.2020.10.009

S. Jiang, (2025), “Predicting Music Popularity: A Machine Learning Approach Using Spotify Data”, pp. 324–328, 2025. https://doi.org/10.5220/0013330000004558

F. Fakhriza et al., (2025), “Optimalisasi Algoritma Random Forest Feature Selection”, vol. 9, no. 1, pp. 16–25, 2025.

S. Mookherjee, S. Dutta, (2024), “Exploring the Emotional Landscape of Music”, pp. 141–146, 2024. https://doi.org/10.20533/icitst.2023.0013

T. Krols, Y. Nikolova, N. Oldenburg, (2023), “Multi-Modality in Music: Predicting Emotion from High-Level Features”, 2023.

F. Khan et al., (2022), “Effect of Feature Selection on the Accuracy of Music Popularity Classification”, Electronics, vol. 11, no. 21, 2022. https://doi.org/10.3390/electronics11213518

Y. Gonzalez, R. C. Prati, (2023), “Comparative Study of Musical Timbral Variations Using FFT-Acoustic Descriptor”, Eng, vol. 4, no. 3, pp. 2468–2482, 2023. https://doi.org/10.3390/eng4030140

B. B. Ginn, N. Johnson, (2024), “Evaluating the Efficacy of Random Forest in Mood Classification”, 2024. https://doi.org/10.13140/RG.2.2.22524.04485

P. Visutsak et al., (2025), “Mood-Based Music Discovery Using Emotion Analysis”, Applied System Innovation, vol. 8, no. 2, 2025. https://doi.org/10.3390/asi8020037

P. Saini, P. Shaktawat, (2024), “Identifying Affective Features of Music Tracks to Determine Their Popularity”, vol. 12, no. 4, pp. 117–129, 2024.

M. R. Dalida et al., (2022), “Music Mood Prediction Based on Spotify’s Audio Features Using Logistic Regression”, IEEE HNICEM, 2022. https://doi.org/10.1109/HNICEM57413.2022.10109396