Emotion-driven Piano Music Generation via Two-stage Disentanglement and Functional Representation

Jingyue Huang, Ke Chen, Yi-Hsuan Yang

Abstract

Managing the emotional aspect remains a challenge in automatic music generation. Prior works aim to learn various emotions at once, leading to inadequate modeling. This paper explores the disentanglement of emotions in piano performance generation through a two-stage framework. The first stage focuses on valence modeling of lead sheet, and the second stage addresses arousal modeling by introducing performance-level attributes. To further capture features that shape valence, an aspect less explored by previous approaches, we introduce a novel functional representation of symbolic music. This representation aims to capture the emotional impact of major-minor tonality, as well as the interactions among notes, chords, and key signatures. Objective and subjective experiments validate the effectiveness of our framework in both emotional valence and arousal modeling. We further leverage our framework in a novel application of emotional controls, showing a broad potential in emotion-driven music generation.

Introduction

Automatic music generation has historically struggled to capture the nuance of human emotion. While modern AI models can generate technically proficient sequences of notes, they often fail to convey specific emotional intents reliably. Most existing models utilize an "end-to-end" approach, attempting to learn all emotional dimensions simultaneously. This frequently results in "arousal-heavy" models: systems that can easily simulate energy through increased tempo or volume but fail to grasp "valence"—the structural harmonic qualities that make music feel inherently happy or sad.

This research addresses these shortcomings by proposing a two-stage Transformer-based framework that disentangles valence from arousal. By introducing a novel "functional representation" that encodes music based on its harmonic role rather than absolute pitch, the model achieves significant improvements in emotional accuracy.

The Challenge of Valence and Arousal

In music psychology, emotion is often mapped onto a two-dimensional space: Arousal (energy, intensity) and Valence (positivity, negativity). Standard symbolic music representations, such as MIDI or REMI, focus on absolute pitches (e.g., "C4"). However, human emotional perception is deeply tied to tonality and functional harmony.

For example, a C-major chord feels like a "home" (tonic) in the key of C, but acts as a "point of tension" (subdominant) in the key of G. Previous models ignored these relative relationships, making it difficult for the AI to learn the structural "rules" of emotional composition. This creates a "valence gap" where models cannot distinguish the structural differences between a happy melody and a sad one, relying instead on performance speed to convey mood.

Methodology

Two-Stage Disentanglement

The authors propose a strategy that mimics the human compositional process by splitting generation into two distinct phases:

  1. Stage 1: Valence Modeling (Lead Sheet Generation): Since valence is primarily driven by harmony and tonality, the model first generates a lead sheet consisting of a melody and chord progression. This stage focuses entirely on the structural composition.
  2. Stage 2: Arousal Modeling (Performance Generation): The model takes the lead sheet and adds "performance-level" attributes, including velocity (loudness), tempo variations, and articulation. These attributes are the primary drivers of perceived arousal.

Functional Representation

To bridge the valence gap, the researchers introduced a novel data representation. Instead of absolute pitches, the model encodes:

  • Scale Degrees: Notes are represented relative to the current key (e.g., "Degree I" instead of "C").
  • Roman Numerals: Chords are encoded by their functional role (e.g., "Chord-IV").
  • Octaves: Relative to the key's root.

This forces the model to learn the functional relationship between notes and the underlying tonality. By using Roman numerals, the model learns that a "Minor i" chord is a strong indicator of low valence across all keys, rather than having to learn the "sadness" of D-minor, E-minor, and F-minor as separate, unrelated entities.

Architecture and Training

The system utilizes two separate Transformer Decoders. A 12-layer Transformer handles the lead sheets, while a "Performer" (a memory-efficient Transformer variant) handles the longer sequences required for expressive performance data. The models were pre-trained on the HookTheory (18,206 lead sheets) and Pop1k7 (1,747 performances) datasets, then fine-tuned on the EMOPIA dataset, which contains 1,071 clips labeled by emotional quadrant.

Experimental Results

The proposed framework demonstrated a marked improvement over baseline methods in both objective and subjective tests:

  • Emotion Classification Accuracy: In subjective listening tests, the Functional two-stage model achieved 71.5% accuracy in conveying the intended emotional quadrant. This is more than double the 31.0% accuracy achieved by a standard REMI-based two-stage model.
  • Valence Performance: The model significantly outperformed baselines in generating "Low Valence" (sad or negative) music, which has historically been a weak point for AI composers.
  • Key Consistency: The functional representation achieved a 0.735 key consistency score, meaning the generated music adhered much more strictly to the intended musical key compared to standard representations, which scored a mere 0.075.

Conclusion and Future Work

By disentangling the structural components of valence from the performance components of arousal, this framework provides a more nuanced approach to AI music composition. The introduction of functional representation acts as a "musical inductive bias," allowing the model to understand harmony in a way that aligns with human perception.

Future work may address current limitations, such as the simplification of mapping positive emotions strictly to major keys and negative emotions to minor keys. Additionally, expanding this functional representation from solo piano to multi-instrument arrangements and allowing for user-provided motifs remain promising avenues for research.

Summary updated

Abstract

Managing the emotional aspect remains a challenge in automatic music generation. Prior works aim to learn various emotions at once, leading to inadequate modeling. This paper explores the disentanglement of emotions in piano performance generation through a two-stage framework. The first stage focuses on valence modeling of lead sheet, and the second stage addresses arousal modeling by introducing performance-level attributes. To further capture features that shape valence, an aspect less explored by previous approaches, we introduce a novel functional representation of symbolic music. This representation aims to capture the emotional impact of major-minor tonality, as well as the interactions among notes, chords, and key signatures. Objective and subjective experiments validate the effectiveness of our framework in both emotional valence and arousal modeling. We further leverage our framework in a novel application of emotional controls, showing a broad potential in emotion-driven music generation.
BibTeX
@inproceedings{huang2024emotion,
  author = {Jingyue Huang and Ke Chen and Yi-Hsuan Yang},
  title = {{Emotion-driven Piano Music Generation via Two-stage Disentanglement and Functional Representation}},
  booktitle = {ISMIR},
  year = {2024},
  url = {https://openreview.net/forum?id=HYPKeUcmlx},
}
Figure