Skip to main content
QUICK REVIEW

[Paper Review] A Classifying Variational Autoencoder with Application to Polyphonic Music Generation

Jay A. Hennig, Akash Umakantha|arXiv (Cornell University)|Nov 19, 2017
Music and Audio ProcessingComputer Science25 references10 citations
TL;DR

This paper proposes a Classifying Variational Autoencoder (CVAE) that integrates a classifier to infer discrete musical key classes during training, enabling controlled generation of polyphonic music in specific keys. By combining the CVAE with an LSTM, the model generates music that stays in key significantly better than standard VAEs, especially when trained on untransposed data in original keys.

ABSTRACT

The variational autoencoder (VAE) is a popular probabilistic generative model. However, one shortcoming of VAEs is that the latent variables cannot be discrete, which makes it difficult to generate data from different modes of a distribution. Here, we propose an extension of the VAE framework that incorporates a classifier to infer the discrete class of the modeled data. To model sequential data, we can combine our Classifying VAE with a recurrent neural network such as an LSTM. We apply this model to algorithmic music generation, where our model learns to generate musical sequences in different keys. Most previous work in this area avoids modeling key by transposing data into only one or two keys, as opposed to the 10+ different keys in the original music. We show that our Classifying VAE and Classifying VAE+LSTM models outperform the corresponding non-classifying models in generating musical samples that stay in key. This benefit is especially apparent when trained on untransposed music data in the original keys.

Motivation & Objective

  • To address the limitation of standard VAEs in generating data from specific modes or classes, such as musical keys.
  • To enable controlled music generation where the model can generate in a user-specified key without requiring data transposition.
  • To allow the model to infer the key from sequence history during inference, supporting real-time improvisation with musicians.
  • To improve key consistency in generated music compared to standard VAE and VAE+LSTM models when trained on original-key data.
  • To demonstrate that modeling key as a discrete class enhances reconstruction quality and musical coherence in sequential music generation.

Proposed method

  • The model extends the standard VAE by introducing a classifier network that predicts the discrete class (e.g., musical key) of each input sequence.
  • The class probabilities are modeled as a Logistic Normal distribution, enabling the use of the reparameterization trick for end-to-end training with stochastic gradient variational Bayes.
  • The latent class variable is sampled during training using the reparameterized gradient, allowing backpropagation through the classifier output.
  • The recognition and generation networks are combined with an LSTM to model sequential dependencies in polyphonic music.
  • The classifier is trained jointly with the VAE’s recognition and generation networks, enabling the model to infer key from input sequence context.
  • The model is trained on untransposed music data, preserving original keys, and can generate samples conditioned on a specified key or infer it from context.

Experimental results

Research questions

  • RQ1Can a VAE be extended to explicitly model and generate from discrete classes such as musical keys without requiring data transposition?
  • RQ2Does incorporating a classifier into the VAE framework improve key consistency in generated polyphonic music sequences?
  • RQ3Can the model infer the key from the sequence history during inference, enabling real-time improvisation with a musician?
  • RQ4How does the performance of the Classifying VAE+LSTM compare to standard VAE+LSTM in generating music that stays in key when trained on original-key data?
  • RQ5Can the model generate high-quality, coherent music samples that maintain tonal consistency across longer sequences?

Key findings

  • The Classifying VAE+LSTM model achieves key consistency in generated samples that matches the key consistency of the original seed sequences when trained on untransposed music data.
  • On data sets in original keys, the Classifying VAE+LSTM outperforms standard VAE+LSTM models in key consistency, which otherwise produce highly inconsistent samples.
  • When provided with the true key of the seed sequence, the Classifying VAE+LSTM achieves better key consistency than all other models across all data sets.
  • For all models, the average number of notes per time step and tone span were within 6% of the JSB Chorales test data, indicating reasonable musical structure.
  • The model successfully learns an interpretable latent space where changing the class label (key) while holding the latent code constant results in different tonal outputs.
  • The use of a Logistic Normal distribution for class probabilities enables efficient training via the reparameterization trick, unlike mixture-of-Gaussians or marginalized discrete class approaches.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.