GACELA: A Generative Adversarial Context Encoder for Long Audio Inpainting of Music

Andrés Marafioti, Piotr Majdak, Nicki Holighaus, Nathanaël Perraudin · DOI

Abstract

In this article, we introduce GACELA, a conditional generative adversarial network (cGAN) designed to restore missing audio data with durations ranging between hundreds of milliseconds and a few seconds, i.e., to perform long-gap audio inpainting. While previous work either addressed shorter gaps or relied on exemplars by copying available information from other signal parts, GACELA addresses the inpainting of long gaps in two aspects. First, it considers various time scales of audio information by relying on five parallel discriminators with increasing resolution of receptive fields. Second, it is conditioned not only on the available information surrounding the gap, i.e., the context, but also on the latent variable of the cGAN. This addresses the inherent multi-modality of audio inpainting for such long gaps while providing the user with different inpainting options. GACELA was evaluated in listening tests on music signals of varying complexity and varying gap durations from 375 to 1500 ms. Under laboratory conditions, our subjects were often able to detect the inpainting. However, the severity of the inpainted artifacts was rated between not disturbing and mildly disturbing.

Introduction

Audio inpainting is the task of restoring missing segments in an audio signal. While restoring tiny clicks or pops (on the order of milliseconds) is a well-studied problem, "long-gap" inpainting—covering hundreds of milliseconds to several seconds—is significantly more complex. When a gap is long, exact reconstruction is impossible because there are infinite ways a melody or rhythm could have continued.

Previous approaches often relied on "exemplars," which involve copy-pasting other parts of the signal. This method fails if the music does not repeat perfectly. Other simple regression models tend to produce "blurry" or muffled audio because they attempt to average all possible outcomes. GACELA (Generative Adversarial Context Encoder for Long Audio) shifts the focus toward generating plausible new musical information that is semantically consistent with the surrounding context.

Methodology

GACELA treats inpainting as a conditional generation task using a Generative Adversarial Network (GAN) architecture.

Overview of the GACELA inpainting pipeline, showing the transition from waveform context to spectrogram generation and final phase reconstruction.

Generator and Context Encoding

The generator acts as a context encoder. It takes audio segments immediately preceding and following the gap (the "context"), encodes them into a latent space, and decodes a log-magnitude Short-Time Fourier Transform (STFT) for the missing segment. To handle the inherent multi-modality of music—where multiple continuations are valid—the generator is conditioned on a 128-dimensional latent variable. This allows the model to produce varied "takes" for the same gap.

Multi-Scale Discriminators

A key innovation in GACELA is the use of five parallel discriminators to ensure the generated audio is coherent at multiple temporal and spectral scales.

The multi-scale discriminator architecture utilizes five parallel units (D1-D5) with varying time-averaging (TA) resolutions to capture both fine textures and broad musical structures.

Two discriminators analyze high-resolution STFTs to capture fine textures, while three others analyze increasingly downsampled Mel-spectrograms. This multi-scale approach forces the model to satisfy both fine-grained audio quality and larger structural musical flow.

Phase Reconstruction

Rather than generating raw waveforms, which is computationally intensive, GACELA generates magnitude spectrograms. It then employs Phase Gradient Heap Integration (PGHI) to reconstruct the phase. PGHI is faster and often yields higher quality results than traditional iterative methods like the Griffin-Lim algorithm.

Experimental Results

The system was evaluated via subjective listening tests where participants had to detect the inpainting and rate its severity across four levels of musical complexity (Simple MIDI, Human MIDI, Real Piano, and Free Music).

  • Detection: Listeners detected the inpainted segments about 84.7% of the time. While not transparent, this is a significant improvement over the near-100% detection of simpler artifact types.
  • Severity: Even when detected, the artifacts were rated as "mildly disturbing" (averaging 1.41 on a 0-3 scale). For comparison, a standard "click" artifact was rated as "unacceptable" (2.83).
  • Consistency: Performance remained relatively stable even as the gap increased from 375ms to 1500ms, suggesting the model is robust to different gap lengths within that range.

Conclusion

GACELA demonstrates that GANs can effectively generate plausible musical content for long gaps where exact reconstruction is impossible. By leveraging multi-scale discriminators and latent variables, the system provides a framework for "content-aware fill" in audio that prioritizes perceptual plausibility over mathematical accuracy. Future work will explore integrating explicit musical priors, such as beat tracking and harmonic progression, to further bridge the gap toward transparent inpainting.

Summary updated

BibTeX
@article{marafioti2020gacela,
  author = {Andrés Marafioti and Piotr Majdak and Nicki Holighaus and Nathanaël Perraudin},
  title = {{GACELA: A Generative Adversarial Context Encoder for Long Audio Inpainting of Music}},
  journal = {IEEE Journal of Selected Topics in Signal Processing},
  year = {2020},
  doi = {10.1109/jstsp.2020.3037506},
}
Figure