Predicting emotional volatility in music using acoustic features and machine learning.
This research investigates whether the emotional volatility of musicβhow much listeners' emotional responses varyβcan be predicted from acoustic features, and whether this prediction differs from predicting average emotional responses.
While most music emotion recognition focuses on mean responses, this study explores the often-overlooked dimension of emotional variance, revealing which songs evoke consistent emotions versus those producing highly varied listener experiences.
Can we predict which songs are emotionally "robust" (consistent across listeners) versus "fragile" (highly variable responses) using only acoustic features?
PMEmo (Personalized Music Emotion Dataset)
- 767 songs with comprehensive acoustic features
- 6,373 initial acoustic features per song
- Listener ratings across multiple contexts
- Emotion labels on Arousal and Valence dimensions
Find the Link - https://www.kaggle.com/datasets/deshadsithsara/pmemo-2018-dataset
H1 β Emotional Volatility is Predictable
Acoustic structure predicts variance of emotion better than, or at least comparably to, mean emotion.
Spoiler: This hypothesis was not supported, leading to valuable insights about the nature of music emotion.
- Static Features: 6,373 acoustic features per song
- Dynamic Features: Temporal statistics derived from acoustic properties
Stage 1: Unsupervised Pruning
- Variance Filtering: Removed 279 near-constant features (variance < 1e-6)
- Collinearity Reduction: Eliminated 2,254 redundant features (correlation > 0.95)
- Result: 6,373 β 3,840 features
Stage 2: Mutual Information Ranking
- Measured dependency between features and targets
- Applied Pareto selection (top 20% of total MI)
- Feature selection per target:
mean_A: 135 featuresmean_V: 172 featuresstd_A: 184 featuresstd_V: 144 features
Critical Finding: Zero intersection among all four targetsβpredicting mean versus variance requires fundamentally different acoustic information.
- Algorithm: ElasticNet Regression
- Split: 70% Train / 20% Validation / 10% Test
- Preprocessing: Standardization after split (prevents data leakage)
- Hyperparameter Tuning: Alpha and L1 ratio optimized via validation
| Target | Train RΒ² | Validation RΒ² | Test RΒ² | Interpretation |
|---|---|---|---|---|
| mean_A | 0.797 | 0.780 | 0.707 | β Excellent β mean arousal highly predictable |
| mean_V | 0.551 | 0.562 | 0.493 | |
| std_A | 0.234 | 0.039 | 0.220 | β Low β arousal variance difficult to predict |
| std_V | 0.107 | 0.029 | -0.028 | β Unpredictable β valence variance not captured |
| Target | Test RΒ² | Best Alpha | Best L1 Ratio |
|---|---|---|---|
| mean_A | 0.657 | 0.001 | 0.1 |
| mean_V | 0.506 | 0.001 | 0.1 |
| std_A | 0.211 | 0.001 | 0.9 |
| std_V | -0.009 | 0.01 | 0.7 |
- Acoustic features excellently predict mean arousal (RΒ² = 0.707)
- Acoustic features moderately predict mean valence (RΒ² = 0.493)
- Acoustic features fail to predict emotional volatility (RΒ² β 0 or negative)
The zero-intersection in feature selection reveals that:
- Features that predict average emotion are completely different from those that would predict variance
- Mean emotion is acoustically determined
- Emotional volatility arises from listener-specific factors
- Current systems relying solely on acoustic features can predict general emotional tone
- They cannot predict how individuals will respond differently
- True personalization requires both acoustic properties AND listener-specific context
Emotional volatility appears to arise from listener-specific factorsβpersonal history, context, mood, cultural backgroundβrather than from the acoustic structure of music itself.
This research demonstrates that:
- Some aspects of musical emotion are acoustically determined (mean responses)
- Others emerge from the interaction between music and individual listeners (emotional variance)
The same frequencies, rhythms, and beats create a consistent baseline vibe, but whether you personally connect with that vibe depends on who you are and where you've been.
# Clone the repository
git clone https://github.com/deshadspace/music-emotion-volatility.git
cd music-emotion-volatility
# Install dependencies
pip install -r requirements.txt
# Run feature selection pipeline
python feature_selection.py --dataset pmemo --variance-threshold 1e-6 --correlation-threshold 0.95
# Train models
python train.py --model elasticnet --split 70-20-10 --features static
# Evaluate results
python evaluate.py --model-path models/elasticnet_static.pklmusic-emotion-volatility/
βββ data/
β βββ pmemo/ # PMEmo dataset
β βββ processed/ # Processed features
βββ src/
β βββ feature_selection.py # Feature pruning & MI ranking
β βββ train.py # Model training pipeline
β βββ evaluate.py # Model evaluation
β βββ utils.py # Helper functions
βββ notebooks/
β βββ EDA.ipynb # Exploratory data analysis
β βββ Feature_Analysis.ipynb # Feature importance analysis
β βββ Results.ipynb # Visualization of results
βββ models/ # Trained models
βββ results/ # Plots and metrics
βββ requirements.txt
βββ README.md
python>=3.8
numpy>=1.21.0
pandas>=1.3.0
scikit-learn>=1.0.0
scipy>=1.7.0
matplotlib>=3.4.0
seaborn>=0.11.0
If you use this code or findings in your research, please cite:
@misc{senevirathne2025musicemotion,
title={Music Emotion Volatility Prediction: A Feature-Based Analysis},
author={Senevirathne, Deshad},
year={2025},
howpublished={\url{https://github.com/deshadspace/music-emotion-volatility}}
}- Incorporate listener metadata and demographic information
- Explore deep learning architectures for temporal modeling
- Investigate cultural and contextual factors in emotional variance
- Develop hybrid models combining acoustic and listener-specific features
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Deshad Senevirathne
- Website: deshadspace.github.io
- GitHub: @deshadspace
- PMEmo dataset creators for providing comprehensive music emotion data
- The music information retrieval research community
- Open-source contributors to scikit-learn and Python ecosystem
β If you found this research interesting, please consider giving it a star!