Skip to content
Open access

Emotion Based Music Player: An Application of Machine Learning

Sep 2026 · Boletim da Sociedade Paranaense de Matemática · 0 citations · 2 references

Abstract

This work presents an Emotion-Based Music Player that integrates a Convolutional Neural Network (CNN) for facial emotion recognition with a rule-based music recommendation engine. The model is trained on a custom subset of the FER-2013 dataset, with face detection performed using the OpenCV Haar Cascade classifier and contrast enhancement applied via Contrast Limited Adaptive Histogram Equalization (CLAHE) to improve robustness to lighting variation. The CNN achieves 74\% training accuracy and 69\% validation accuracy across seven emotion classes (Happy, Sad, Angry, Neutral, Surprised, Disgust, Fear). The trained model is deployed in a real-time pipeline using OpenCV-based live video analysis, where detected facial expressions are continuously classified and mapped to a curated, royalty-free music library. Unlike prior emotion-based music recommendation systems, this work emphasizes a transparent, rule-based mapping strategy that avoids copyright dependencies and supports user feedback for iterative refinement. We report per-class precision, recall, and F1-score alongside a confusion matrix, and compare our results against existing CNN-based approaches in the literature. The system operates at 12--15 FPS with a live classification accuracy of 65--70\%, with the largest sources of error identified as lighting conditions and confusion between the Neutral and Surprised classes.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.