Polyphonic Music Generation with Sequence Generative Adversarial Networks

Sang-gil Lee, Uiwon Hwang, Seonwoo Min, Sungroh Yoon

Abstract

We propose an application of sequence generative adversarial networks (SeqGAN), which are generative adversarial networks for discrete sequence generation, for creating polyphonic musical sequences. Instead of a monophonic melody generation suggested in the original work, we present an efficient representation of a polyphony MIDI file that simultaneously captures chords and melodies with dynamic timings. The proposed method condenses duration, octaves, and keys of both melodies and chords into a single word vector representation, and recurrent neural networks learn to predict distributions of sequences from the embedded musical word space. We experiment with the original method and the least squares method to the discriminator, which is known to stabilize the training of GANs. The network can create sequences that are musically coherent and shows an improved quantitative and qualitative measures. We also report that careful optimization of reinforcement learning signals of the model is crucial for general application of the model.

Introduction

Generating music with AI typically involves either continuous audio waveforms or discrete symbolic sequences like MIDI. While deep learning has seen success in symbolic generation, polyphony—the simultaneous play of multiple notes or a melody with chords—remains a significant challenge. Generative Adversarial Networks (GANs) are difficult to apply to discrete data because the non-differentiable nature of discrete choices prevents standard backpropagation. Furthermore, representing the complex relationship between melody and harmony without excessive manual feature engineering is a major hurdle.

Methodology

The authors extend the Sequence Generative Adversarial Network (SeqGAN) framework to handle polyphonic music by treating sequence generation as a reinforcement learning (RL) task.

The SeqGAN Architecture

The system utilizes a Recurrent Neural Network (LSTM) as the Generator and a Convolutional Neural Network (CNN) as the Discriminator. Since the generator produces discrete tokens, the discriminator's output (a "real vs. fake" score) serves as a reward signal. The generator is updated via Policy Gradient methods, employing Monte Carlo search rollouts to estimate the long-term value of specific musical transitions.

The SeqGAN architecture for music generation, showing the RL loop and Monte Carlo Policy Rollout.

Unified Musical Word Representation

A core innovation of this work is the "musical word" representation. Instead of processing separate tracks for melody and harmony, the model condenses duration, octave, and pitch of a melody note, along with the octave and pitch set of the accompanying chord, into a single integer token. This allows the network to learn the interplay between melody and harmony as a unified language.

The preprocessing pipeline converting MIDI files into a unified token sequence of "musical words."

To stabilize training and avoid the "vanishing gradient" problem common in GANs, the authors implemented a Least Squares GAN (LS-GAN) loss. They also optimized the discriminator’s receptive field to focus on periodic musical structures rather than local artifacts.

Experimental Setup

The model was trained on the Nottingham Database, containing 1,200 British and American folk tunes. Using the music21 library, the researchers parsed MIDI files into a vocabulary of 3,216 unique "musical words" (filtering out combinations appearing fewer than 10 times). The model was tasked with generating sequences of 100 tokens.

Results and Discussion

The proposed approach was evaluated using both quantitative metrics and human qualitative studies.

  • Quantitative Performance: Adversarial training significantly improved the BLEU-4 score (measuring similarity to real data) from 0.53 (pre-training) to over 0.68 with the LS-SeqGAN configuration.
  • Qualitative Human Evaluation: In a study with 42 participants, adversarial samples were rated significantly higher for being "Pleasant," "Real," and "Interesting" compared to standard maximum likelihood models.
  • Structural Coherence: The model successfully moved beyond short-term repetition, producing consistent chord progressions and long-term harmonic structures.

Interestingly, the "unconditional" model (generating from scratch) outperformed the "conditional" model (starting with a real note). This suggests that the unconditional model is better at exploring the data manifold without being constrained by specific starting points that might lead to local minima.

Conclusion and Future Work

While the model shows promise, it faces limitations such as occasional "mode collapse" and a vocabulary restricted to seen combinations. Future work could involve more modular architectures to understand functional musical relationships (e.g., transpositions) and integrating music theory rules as additional RL reward signals to further refine compositional quality.

Summary updated

BibTeX
@article{lee2017polyphonic,
  author = {Sang-gil Lee and Uiwon Hwang and Seonwoo Min and Sungroh Yoon},
  title = {{Polyphonic Music Generation with Sequence Generative Adversarial Networks}},
  journal = {Journal of KIISE},
  year = {2017},
}
Figure