DOI: 10.5281/zenodo.17482112
title: EmoMusicCommNet

description: EmoMusicCommNet: Emotion-Aware Music Modeling for Cultural Communication



A deep learning framework that jointly models musical emotion and cultural context using multi-modal encoding, cross-attention fusion, and adaptive regularization.




📘 Overview

EmoMusicCommNet links emotional expression in music with cultural perception.It combines a bi-RNN emotion encoder, cultural embeddings, emotion-specific cross-attention, and an adaptive cultural regularizer to support cross-cultural music understanding, emotion-aware recommendation, and personalized cultural communication.

Core modules



Emotion Encoder (EAMCN): Bi-GRU/LSTM over frame-level music features

EDCCS / ESAM: Emotion-specific attention that conditions on cultural embeddings

ARCS: Adaptive regularization for cultural specificity and generalization

Task Head: Classification (emotion labels) or regression (valence/arousal, etc.)




🚀 Features



Multi-modal fusion of music sequence + cultural context

Emotion-driven cross-attention for interpretable alignment

Adaptive regularization to balance universality vs. cultural specificity

Drop-in classification or regression head

Clean PyTorch implementation with config-driven training




🧱 Repository Structure



bash





 



EmoMusicCommNet/
│
├── src/
│   ├── models/
│   │   └── emomusiccommnet.py      # Model (EAMCN + EDCCS/ESAM + ARCS)
│   ├── data.py                     # Dataset loading & preprocessing
│   ├── train.py                    # Training / evaluation script
│   └── utils.py                    # Metrics, logging, helpers
│
├── configs/
│   └── config.yaml                 # Hyperparameters & paths
│
├── data/
│   └── sample_data.csv             # Example dataset (optional)
│
├── results/
│   ├── logs/                       # Train/eval logs
│   └── checkpoints/                # Saved models
│
├── requirements.txt
└── README.md





⚙️ Installation



bash





 



# Clone
git clone https://github.com/yourusername/EmoMusicCommNet.git
cd EmoMusicCommNet

# (Optional) Create a virtual environment
python -m venv .venv
# Linux/Mac
source .venv/bin/activate
# Windows
.venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt





📦 Data Format

You can store samples as CSV or JSON. A minimal row format:




field
type
description




music_seq
JSON array
[[f1,..,fF], ..., [f1,..,fF]] T×F features


culture_id
int
Optional categorical culture index


culture_vec
JSON array
Optional continuous culture/context features


label
int/float
Class index (clf) or target value (reg)






Tip: Normalize music features per track; pad/truncate sequences to a fixed length during preprocessing (handled in data.py).




🔧 Configuration (example: configs/config.yaml)



yaml





 



task: classification            # or: regression
num_classes: 7

model:
  music_feat_dim: 96
  culture_vec_dim: 24
  num_cultures: 8
  culture_emb_dim: 32
  d_model: 128
  rnn_type: gru                 # gru | lstm
  rnn_layers: 2
  n_heads: 4
  dropout: 0.1

train:
  batch_size: 32
  epochs: 50
  lr: 3e-4
  weight_decay: 1e-4
  seed: 42

data:
  train_path: data/train.csv
  val_path:   data/val.csv
  test_path:  data/test.csv
  max_len: 120





▶️ Usage

Train:



bash





 



python src/train.py --config configs/config.yaml



Evaluate:



bash





 



python src/train.py --config configs/config.yaml --mode eval



Predict (single file or folder):



bash





 



python src/train.py --config configs/config.yaml --mode predict --input data/infer.csv --output results/preds.csv





🧪 Metrics



Classification: Accuracy, F1, AUC

Regression: MAE, MSE, PCC/SRCC

Cultural alignment (optional): prototype variance / cluster cohesion




📝 Model Notes



Model file: src/models/emomusiccommnet.py

Key losses you may combine in training:



Primary task loss (CrossEntropy or MSE)

Optional ARCS terms (intra-culture attraction, inter-culture diversity)




Example (pseudocode):



python





 



y_hat, aux = model(music_seq, culture_id, culture_vec, return_aux=True)
loss = task_loss(y_hat, y)
loss += aux.get('loss_arcs_intra', 0.) + aux.get('loss_arcs_inter', 0.)





📚 Citation

If this repository helps your research, please cite:



css





 



@article{emomusiccommnet2025,
  title   = {EmoMusicCommNet: Emotion-Aware Music Modeling for Cultural Communication Contexts},
  year    = {2025},
  journal = {TBD},
  author  = {Your Name}
}





📄 License

Released under the MIT License. See LICENSE for details.



🤝 Contributing

Pull requests are welcome! Please open an issue for major changes and discuss your ideas first.



📬 Contact



Maintainer: Your Name

Email: your.email@example.com