Graph-based Polyphonic Multitrack Music Generation

Emanuele Cosenza, Andrea Valenti, Davide Bacciu

Introduction

Generating music that resonates with human listeners is a complex challenge for artificial intelligence. While contemporary models excel at mimicking surface-level textures, they often struggle with long-term coherence and the underlying hierarchical structures that unify a composition. In research presented at IJCAI-23, a team from the University of Pisa introduced a novel approach that departs from treating music as a simple sequence of tokens. Instead, they model multitrack, polyphonic music as a graph, enabling a more nuanced representation of the relationships between different instruments and harmonic structures.

The Challenge of Hierarchical Music

Most existing music generation models, such as Transformers or LSTMs, treat music as a linear sequence akin to text. Others utilize "pianorolls," treating music as a two-dimensional image. However, music is inherently hierarchical: notes form chords, chords form bars, and bars form tracks that interact simultaneously. Furthermore, the "black box" nature of many generative models limits human-AI collaboration. Artists often require granular control—such as modifying rhythm while preserving melody—which traditional models struggle to provide without regenerating the entire piece.

Proposed Methodology

The core innovation of this work lies in its dual-pronged approach: a novel graph-based music representation and a hierarchical Variational Autoencoder (VAE) architecture.

Graph-based Music Representation

The researchers represent music as a "chord-level graph." In this model, nodes represent the activation of a chord in a specific track at a specific time. Edges are used to model three distinct types of relationships:

  • Track edges: Connecting consecutive chords within the same instrument.
  • Onset edges: Connecting simultaneous chords across different instruments.
  • Next edges: Connecting consecutive chords across different instruments.
Figure 1: The transition from (a) raw note data to (b) a structural grid and finally (c) a graph-based representation.

Hierarchical VAE Architecture

To process this representation, the authors developed a Deep VAE that bifurcates the generation process into two distinct streams:

  1. Structure Encoder/Decoder: Utilizes Convolutional Neural Networks (CNNs) to manage the "where and when"—the binary grid defining which tracks are active at specific timesteps.
  2. Content Encoder/Decoder: Employs Graph Convolutional Networks (GCNs) to handle the "what"—the specific pitches and durations of notes within active slots.
Figure 2: The hierarchical VAE architecture, showing the separation of content (c) and structure (s) pathways into a joint latent space.

By decoupling structure from content, the model allows for "structure-conditioned" generation. A user can specify a rhythmic "skeleton," and the model populates it with tonal content that adheres to the learned musical style.

Key Insights and Results

The separation of concerns provides significant interpretability. A striking emergent property was observed in the model's latent space: it organized itself according to music theory principles without explicit programming. Visualizations revealed that pitch embeddings formed a circular pattern resembling the Circle of Fifths, while durations were grouped by rhythmic function.

Quantitative and Qualitative Performance

The model was trained on the LMD-matched and MetaMIDI (MMD) datasets. Quantitatively, it matched or outperformed baselines like MuseGAN in rhythmic consistency, achieving high Drum Pattern (DP) scores. Qualitatively, listening tests confirmed that the 2-bar models produced highly consistent chord progressions.

The researchers also demonstrated successful human-AI interaction. By manually editing the activation grid of a generated sequence (e.g., making drums sparser), the model could "re-render" the musical content to fit the new structure while maintaining the original harmonic integrity.

Conclusion and Future Work

While the model excels at 2-bar coherence, 16-bar sequences occasionally exhibited excessive repetition. Future research will focus on improving the "narrative" arc of longer pieces, potentially by incorporating recurrent architectures or "sustain" edges to better model long-held notes. Despite these limitations, the graph-based approach marks a significant step toward more controllable and structurally aware AI music generation.

Summary updated

BibTeX
@inproceedings{cosenza2023graph,
  author = {Emanuele Cosenza and Andrea Valenti and Davide Bacciu},
  title = {{Graph-based Polyphonic Multitrack Music Generation}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/643},
}
Figure