Domain Adversarial Training on Conditional Variational Auto-Encoder for Controllable Music Generation

Jingwei Zhao, Gus Xia, Ye Wang

Introduction

Controllable music generation aims to produce musical sequences that adhere to specific constraints, such as generating a chord progression that complements a given melody. While Conditional Variational Auto-Encoders (C-VAEs) are a standard framework for this task, they often suffer from "condition collapse." In this phenomenon, the model's latent representation ($z_x$) inadvertently captures information from the condition (the melody), leading the decoder to ignore the external control signal in favor of its internal summary. This results in outputs that may be musically coherent but fail to follow the provided constraints.

Addressing Condition Collapse

The core issue in music C-VAEs is the natural entanglement between melody and harmony. Because they are highly correlated, a standard encoder will encode melodic features into the latent space. To combat this, the authors propose a framework using Domain Adversarial Training (DAT) to disentangle these components.

Domain Adversarial Training (DAT)

The researchers introduce a discriminator network designed to extract melody information from the latent representation $z_x$. During training, the encoder is optimized to "fool" this discriminator. By minimizing the discriminator's ability to identify melodic features, the encoder is forced to produce a latent space that is invariant to the specific melody, effectively scrubbing it of redundant control information.

Condition Corruption and Denoising

Standard DAT often uses simple categorical labels (e.g., mood or genre). However, melodies are complex, high-dimensional sequences. The authors argue that predicting a melody directly from a latent style is ill-posed, as many melodies can fit a single style. Instead, they propose a "condition corruption" objective.

The melody is corrupted via random transposition, which preserves the rhythmic structure (the context) but breaks the specific harmonic relationship (the dependency). The discriminator's task is to "denoise" or "fix" this corrupted melody using information from $z_x$. By training the encoder to prevent the discriminator from succeeding, the model learns a pitch-invariant representation of musical style that does not rely on specific note values.

Experimental Framework

The model was built upon the PianoTree VAE, a hierarchical architecture suited for polyphonic music. Training was conducted on two primary symbolic music datasets:

  • Nottingham Database: A collection of folk tunes.
  • POP909: A dataset containing 909 popular piano arrangements.

The data was processed into 35,000 8-bar snippets. Melodies were quantized to 16th notes and chords to the beat. To ensure robustness, data augmentation was performed by transposing all samples into all 12 musical keys.

Key Insights

Denoising vs. Prediction

A significant finding of this work is that for sequential data like music, a denoising objective provides a more stable and effective training signal for adversarial learning than direct prediction. This approach allows the model to focus on the underlying structural "shape" of the music rather than getting lost in the complexity of sequence prediction.

The Tritone Discovery

The researchers observed that the learned latent space aligns with human musical perception. When a chord progression was transposed by a tritone—the most dissonant interval—the resulting latent representation became nearly orthogonal to the original. This suggests that the DAT-CVAE framework successfully captures fundamental rules of music theory without explicit supervision.

Results and Evaluation

The proposed DAT-CVAE was compared against standard VAEs and alternative corruption methods (such as BERT-style masking).

  • Subjective Quality: In a double-blind listening study with 38 participants, the DAT-CVAE significantly outperformed baselines in terms of harmonicity, creativity, and overall musicality ($p < 0.05$).
  • Objective Metrics: The model demonstrated superior "pitch invariance," maintaining a consistent latent style across transpositions. Furthermore, analysis of harmony histograms showed that the generated chords matched the ground-truth harmonic structure of the melodies far more accurately than baseline models, which frequently produced dissonant results.

Conclusion and Future Work

This research demonstrates that Domain Adversarial Training, combined with a domain-specific corruption strategy, can effectively mitigate condition collapse in music generation. While currently limited to standard triads and seventh chords, the DAT-CVAE framework provides a robust foundation for future work in controllable music generation, including style transfer and complex texture generation.

Summary updated

BibTeX
@inproceedings{zhao2022domain,
  author = {Jingwei Zhao and Gus Xia and Ye Wang},
  title = {{Domain Adversarial Training on Conditional Variational Auto-Encoder for Controllable Music Generation}},
  booktitle = {ISMIR},
  year = {2022},
}
Figure