MusicMamba: A Dual-Feature Modeling Approach for Generating Chinese Traditional Music with Modal Precision

Jiatao Chen, Tianming Xie, Xing Tang, Jing Wang, Wenjing Dong, Bing Shi · DOI

TL;DR

MusicMamba introduces a hybrid architecture that combines the long-range modeling of State Space Models (Mamba) with the global structural awareness of Transformers to generate authentic Chinese traditional music. By introducing a new representation called REMI-M and a specialized dataset (FolkDB), the researchers achieved significantly higher modal precision and stylistic consistency compared to existing Western-centric models.

What Problem Does This Paper Address?

Most AI music generation research focuses on Western music, which typically follows major/minor scales and standard harmonic structures. Chinese traditional music, however, is built on complex modal systems (like pentatonic and heptatonic scales) where the relationship between notes—the "mode"—dictates the emotional and stylistic character.

Existing models like the MusicTransformer often struggle with these nuances. They might produce "smooth" melodies that sound modern or Westernized, failing to capture the unique melodic contours, rhythmic "groove," and transitions specific to Chinese folk traditions. Furthermore, there has been a significant lack of high-quality, annotated symbolic music (MIDI) datasets for Chinese traditional music to train these models effectively.

Methods

The authors propose a multi-pronged approach to capture both the "micro" (melodic transitions) and "macro" (overall structure) of Chinese music:

  1. Dual-Feature Modeling Module: This is the core architecture. It runs a Mamba Block and a Transformer Block in parallel.
  2. The Mamba Block (a State Space Model) is leveraged for its efficiency in modeling long-range dependencies and capturing fine-grained melodic details.
  3. The Transformer Block focuses on capturing the global structure (phrases and repetition patterns).
  4. Bidirectional Mamba Fusion Layer: To merge the outputs of the two blocks, the authors designed a fusion layer that uses bidirectional scanning. This ensures that the model considers both preceding and succeeding musical context when generating a note, which is vital for maintaining modal consistency.
  5. REMI-M Representation: The researchers extended the standard REMI (Revamped MIDI) representation. They added Note type events (distinguishing between "mode notes" and "transition notes") and Mode-related events (explicitly marking the start, end, and type of a musical mode). This allows the model to "understand" the theoretical framework of the music it is generating.

Datasets

  • POP909: A well-known dataset of Chinese pop songs used here for pre-training to help the model learn fundamental musical structures.
  • FolkDB (New): The authors curated a new dataset of approximately 300 high-quality Chinese traditional music pieces (over 11 hours of MIDI data). It features diverse styles and explicit annotations for pentatonic and heptatonic modes.

Key Insights and Ideas

  • Hybridization is Key: The "aha moment" here is that neither Mamba nor Transformers are perfect for music in isolation. Mamba excels at the "flow" of a melody, while Transformers excel at the "blueprint." Combining them allows for music that is both locally coherent and globally structured.
  • Explicit Theory Matters: Simply feeding raw MIDI to a model isn't enough for culturally specific music. By encoding music theory (modes) directly into the REMI-M representation, the model learns the "grammar" of the genre rather than just statistical note distributions.
  • Bidirectional Context: Music isn't just a forward-moving sequence; a note's "correctness" often depends on where the melody is going next. The bidirectional fusion layer addresses this by integrating future and past structural information.

Key Results

The researchers compared MusicMamba against baselines like MusicTransformer and MelodyT5 using both objective metrics and subjective listening tests:

  • Style Consistency: MusicMamba achieved a score of 85.3%, significantly outperforming the MusicTransformer (69.7%) and MelodyT5 (67.9%).
  • Mode Consistency: The model reached 66.1% consistency, nearly double that of the basic MusicTransformer (37.5%).
  • Pitch Entropy: The model's Average Pitch Entropy (4.070) was the closest to the ground truth (3.831), suggesting it generates a more natural and diverse range of notes than its competitors.
  • Subjective Tests: In human evaluations, MusicMamba scored highest across Coherence (7.91), Richness (7.72), and Style (8.26) on a 10-point scale.

Limitations and Future Work

While MusicMamba shows great promise, the authors note a few areas for growth:

  • Dataset Scale: While FolkDB is a significant contribution, 11 hours of music is still small compared to the massive datasets used for Western music. Expanding this corpus is essential.
  • Instrumental Diversity: The current work focuses largely on melodic generation (often represented as piano MIDI). Future work could incorporate the specific idiomatic playing techniques of traditional Chinese instruments like the Guzheng or Pipa.
  • Complex Polyphony: The paper primarily addresses melody; extending this dual-feature approach to complex multi-instrumental arrangements remains a frontier for the team.

Summary updated

Abstract

In recent years, deep learning has significantly advanced the MIDI domain, solidifying music generation as a key application of artificial intelligence. However, existing research primarily focuses on Western music and encounters challenges in generating melodies for Chinese traditional music, especially in capturing modal characteristics and emotional expression. To address these issues, we propose a new architecture, the Dual-Feature Modeling Module, which integrates the long-range dependency modeling of the Mamba Block with the global structure capturing capabilities of the Transformer Block. Additionally, we introduce the Bidirectional Mamba Fusion Layer, which integrates local details and global structures through bidirectional scanning, enhancing the modeling of complex sequences. Building on this architecture, we propose the REMI-M representation, which more accurately captures and generates modal information in melodies. To support this research, we developed FolkDB, a high-quality Chinese traditional music dataset encompassing various styles and totaling over 11 hours of music. Experimental results demonstrate that the proposed architecture excels in generating melodies with Chinese traditional music characteristics, offering a new and effective solution for music generation.
BibTeX
@misc{chen2024musicmamba,
  author = {Jiatao Chen and Tianming Xie and Xing Tang and Jing Wang and Wenjing Dong and Bing Shi},
  title = {{MusicMamba: A Dual-Feature Modeling Approach for Generating Chinese Traditional Music with Modal Precision}},
  year = {2024},
  eprint = {2409.02421},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.02421},
}
Figure