NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MusER: Musical Element-Based Regularization for Generating Symbolic Music with Emotion

Shulei Ji, Xinyu Yang

Abstract

Generating emotionally expressive music with fine-grained control remains a significant challenge in symbolic music generation. Most existing models treat emotion as a global attribute, limiting interpretability and precise manipulation. We present MusER, a novel framework that disentangles discrete musical elements—such as pitch, duration, and velocity—within a latent space using Musical Element-based Disentanglement (MED) and a two-level decoding strategy. By regularizing variation patterns, MusER enables "musical surgery," allowing for the transfer of specific emotional characteristics between pieces. Experimental results on the EMOPIA dataset demonstrate that MusER outperforms state-of-the-art models in both objective musicality and subjective emotional controllability.

Introduction

While artificial intelligence has made strides in generating music that "sounds" emotional, the underlying mechanisms often remain opaque. Most current models treat emotion as a global label, acting as a "black box" that struggles with fine-grained control. For instance, increasing the "excitement" (arousal) of a piece might require specific manipulation of velocity (loudness) or rhythm without altering the core melody.

The technical challenge lies in disentanglement. In typical latent variable models, musical features are often entangled. Furthermore, while most disentanglement research focuses on continuous attributes, musical elements are discrete sequences. MusER addresses this by creating a structured latent space where individual musical elements are isolated and controllable.

Methodology

MusER is built upon a Vector-Quantized Variational Autoencoder (VQ-VAE) backbone, utilizing Compound Word (CP) representation to group related attributes into single time-step tokens. Its architecture introduces two primary innovations:

  1. Musical Element-based Disentanglement (MED): This module employs a specialized regularization loss ($L_R$) that targets the variation patterns of sequences rather than single values. It ensures that shifts in input sequences (e.g., an increase in velocity) correspond to specific shifts in designated latent dimensions, forcing the model to encode elements into distinct "slots."
  2. Two-level Decoding (TD): To ensure musical coherence, the model uses a hierarchical approach. A Global Decoder captures the overall structure, while seven individual Element Decoders (e.g., for pitch, velocity, duration) attend to their respective disentangled latent variables.
Overview of the MusER architecture featuring element disentanglement and two-level decoding.

Experimental Setup

The model was pre-trained on the Pop1k7 dataset (1,748 piano covers) to learn general musical structures and fine-tuned on EMOPIA, which contains 1,087 pop piano clips annotated with emotion labels based on the Arousal-Valence (A-V) model. Emotions are categorized into four quadrants: Q1 (High Arousal/High Valence), Q2 (Low Arousal/High Valence), Q3 (Low Arousal/Low Valence), and Q4 (High Arousal/Low Valence).

Results and Discussion

MusER demonstrated superior performance across objective metrics such as Pitch Range (PR) and Polyphony (POLY), closely matching the statistical properties of human-composed music. In subjective listening tests, it achieved high scores for Humanness (4.00/5) and Overall Quality (3.78/5).

Interpretable Latent Space and Emotion Control

Visualization using t-SNE confirmed that MusER successfully clusters different musical elements into distinct regions, enhancing transparency. Analysis revealed that velocity serves as the primary "volume knob" for arousal, followed by pitch. Crucially, the authors found that the temporal variation of these elements carries more emotional weight than simple statistics.

Musical Surgery: Element Transfer

The disentangled latent space allows for "element transfer," where specific attributes of one song are swapped with another. For example, the melody of a sad song can be combined with the velocity and rhythm of a happy song. Subjective tests showed high success in this "musical surgery." When transferring elements to shift emotional intensity, up to 90% of human listeners correctly perceived the intended emotional quadrant shift.

Human perception of emotional shifts after transferring specific musical elements.

Conclusion

MusER provides a robust framework for interpretable and controllable emotional music generation. By disentangling discrete musical elements, it moves beyond "black box" generation toward a more surgical approach to musical expression. Future work will address the challenges of controlling Valence (positivity/negativity), which remains more complex than Arousal, and improving harmonic cohesion when merging disparate musical elements.

Summary updated

BibTeX
@inproceedings{ji2024muser,
  author = {Shulei Ji and Xinyu Yang},
  title = {{MusER: Musical Element-Based Regularization for Generating Symbolic Music with Emotion}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i11.29178},
}
Figure