Emotion Embedding Spaces for Matching Music to Stories

Minz Won, Justin Salamon, Nicholas J. Bryan, Gautham J. Mysore, Xavier Serra

Finding the right music to accompany a narrative is a complex task due to the "modality gap" between text and audio. This paper, presented at ISMIR 2021, proposes a cross-modal retrieval system that aligns stories and music within a shared emotion embedding space. By employing a novel three-branch metric learning approach, the system bridges disparate emotional taxonomies, allowing for nuanced, data-driven matching that moves beyond simple keyword search.

The Challenge of Mismatched Taxonomies

Content creators frequently face the challenge of selecting a soundtrack that accurately reflects the emotional arc of a story. While extensive datasets exist for both text and music emotions, they often utilize incompatible labeling systems. For instance, a text dataset might label a sentence with complex social emotions like "guilt" or "shame," while a music library categorizes tracks by broader moods like "tender" or "scary."

Conceptual mapping of text and music to a shared emotional space.

This "mismatched taxonomy" problem makes standard supervised learning difficult. To address this, the authors aim to create a unified embedding space where text paragraphs and music clips can be compared directly based on their underlying emotional content, regardless of the specific categorical labels used in their respective domains.

Methodology: Bridging the Modality Gap

The researchers evaluated six deep learning strategies to bridge this gap, primarily focusing on three architectural approaches:

  1. Feature Extraction: The system utilizes DistilBERT for text analysis and a ResNet (trained on mel-spectrograms) for audio analysis.
  2. Regression-based Alignment: This approach maps both modalities into a pre-defined emotional coordinate system, such as the Valence-Arousal (V-A) space or Word2Vec embeddings.
  3. Metric Learning:
    • Two-branch: This model learns to minimize the distance between "matching" text and music pairs in an embedding space using a triplet loss.
  4. Three-branch (The Core Innovation): This architecture adds a third branch for "Tags" (using Word2Vec). By training the model to align text-to-tag, music-to-tag, and text-to-music simultaneously, the model learns the underlying "neighborhood structure" of emotions. This prevents the model from collapsing into discrete clusters and instead creates a continuous emotional landscape.
Architectural variants for cross-modal emotion embedding: (a) Regression, (b) Shared MLP, (c) Two-branch metric learning, and (d) Three-branch metric learning.

Datasets and Experimental Setup

The study utilized several established benchmarks to test cross-modal performance:

  • Text: Alm’s affect dataset (1,207 sentences from classic stories) and the ISEAR dataset (7,666 sentences categorized into seven emotions).
  • Music: A subset of AudioSet containing nearly 17,000 music clips categorized into 7 mood categories (happy, funny, sad, tender, exciting, angry, and scary).

Key Insights and Results

The authors measured performance using Precision at 5 (P@5) and Mean Reciprocal Rank (MRR). A key finding was that preserving emotional neighborhoods is crucial; the three-branch model ensures that related emotions (e.g., "angry" and "scary") remain proximal in the embedding space, even if they are not identical.

  • V-A Regression performed exceptionally well on the Alm dataset (P@5 of 0.6100), proving that classic psychological models of emotion remain powerful tools for retrieval.
  • Three-branch Metric Learning showed superior performance on the more complex ISEAR dataset (P@5 of 0.4317), outperforming the two-branch version.
  • Qualitative Visualization: UMAP projections revealed that the three-branch model successfully grouped "fearful" text near "scary" music and "joyful" text near "happy" music, creating a much more intuitive emotional map than standard classification-based models.

Conclusion and Future Work

By leveraging Word2Vec as an anchor in a three-branch architecture, the system achieves a flexible, data-driven alignment of text and music. This approach facilitates "zero-shot" retrieval—matching music to words never seen during training—by leveraging existing semantic relationships. Future work will explore handling long-form narrative arcs where moods shift over time and expanding the model to include specific thematic categories beyond basic emotions.

Summary updated

BibTeX
@inproceedings{won2021emotion,
  author = {Minz Won and Justin Salamon and Nicholas J. Bryan and Gautham J. Mysore and Xavier Serra},
  title = {{Emotion Embedding Spaces for Matching Music to Stories}},
  booktitle = {ISMIR},
  year = {2021},
}
Figure