PIANOTREE VAE: Structured Representation Learning for Polyphonic Music

Ziyu Wang, Yiyi Zhang, Yixiao Zhang, Junyan Jiang, Ruihan Yang, Gus Xia, Junbo Zhao

Introduction

Polyphonic music, such as piano compositions, presents a significant challenge for generative AI. Unlike monophonic melodies, polyphony involves multiple notes played simultaneously, creating a complex "musical syntax" where events are grouped both vertically (chords) and horizontally (sequences). Traditional models like MusicVAE often struggle with this dimensionality, frequently treating music as a flat sequence or a 2D "piano-roll" grid. These approaches often fail to capture the underlying structural relationships, leading to musically incoherent results.

PianoTree VAE addresses this by introducing a hierarchical, tree-structured Variational Autoencoder. By embedding the natural hierarchy of music—notes, simultaneous note groups, and full scores—directly into the model's architecture, it learns a deeply musical latent space that outperforms traditional sequence-based models.

The PianoTree Architecture

The core innovation of this research is the tree-structured neural network designed to mirror musical hierarchy. The model defines a three-level tree:

  1. Note: The leaf nodes, containing pitch and duration data.
  2. Simu_note: A middle layer representing multiple notes sharing the same onset (essentially a chord or a vertical slice of music).
  3. Score: The root node, representing the summary of the entire musical segment.
The hierarchical structure of PianoTree VAE, mapping scores to simultaneous note groups and individual notes.

Encoder and Decoder

The Encoder works bottom-up, using bi-directional Gated Recurrent Units (GRUs) to summarize individual notes into simu_notes, which are then condensed into a single score embedding. This embedding is mapped to a latent code ($z$). The Decoder reverses this top-down, using a time-axis GRU to generate a sequence of simu_notes, which are then expanded by a pitch-axis GRU into individual notes. This sparse encoding is more computationally efficient than dense piano-rolls and less prone to generating "garbage" notes.

Visualizing the Latent Space

By forcing the model to "think" in terms of notes and chords, the researchers provided a powerful inductive bias. This resulted in a latent space that naturally organized itself according to music theory principles without explicit instruction.

Visualizing the learned latent space: (a) shows the 3D pitch helix, and (c) shows the fractal parallelogram structure of note durations.
  • The Latent Helix: When visualizing individual notes, the model organized pitches into a 3D helix. The vertical axis represents increasing pitch, while the circular cross-section represents "chroma" (e.g., all 'C' notes cluster together in the circle).
  • The Circle of Fifths: For chords (simu_notes), the latent space naturally reconstructed the Circle of Fifths, recognizing that a C-major chord is musically "closer" to G-major than to C-sharp major.
  • Translation Invariance: Using binary encoding for duration allowed the model to learn a "fractal parallelogram" structure. This ensures that duration relationships (e.g., a half-note being twice a quarter-note) remain consistent across different pitches.

Key Results and Performance

The PianoTree VAE was evaluated against four baselines using a dataset of 5,000 classical and popular piano pieces from Musicalion and POP909.

  • Reconstruction Accuracy: PianoTree achieved superior F1 scores for both onset (0.9545) and duration (0.9869), significantly outperforming MIDI-sequence baselines.
  • Subjective Quality: In double-blind listening tests, human participants rated PianoTree's interpolations as smoother and more musical than those of competing models.
  • Generative Potential: When used as a backbone for a Transformer, the PianoTree representations produced more natural and creative long-term musical structures.

Limitations and Future Work

Currently, the model is optimized for piano scores and does not account for multiple instruments, velocity (dynamics), or micro-timing nuances. Future research aims to expand this syntax to include multi-part polyphony and more complex motif development to further improve long-term structural coherence in AI-generated music.

Summary updated

BibTeX
@inproceedings{wang2020pianotree,
  author = {Ziyu Wang and Yiyi Zhang and Yixiao Zhang and Junyan Jiang and Ruihan Yang and Gus Xia and Junbo Zhao},
  title = {{PIANOTREE VAE: Structured Representation Learning for Polyphonic Music}},
  booktitle = {ISMIR},
  year = {2020},
  url = {https://openreview.net/forum?id=irgsw4YD1WZ},
}
Figure