Introduction
Sound synthesis is a sophisticated art form requiring deep technical expertise. Recreating a specific sound—a process known as "sound matching"—on a modular synthesizer involves the intricate tuning of dozens of interacting parameters, including oscillator frequencies, filter cutoffs, and envelope timings. Traditionally, these synthesizers have functioned as "black boxes" in the context of machine learning, lacking support for automatic differentiation. This limitation prevents the use of backpropagation to optimize synthesizer settings directly against a target sound.
While deep learning has previously been applied to sound matching, existing solutions often sacrifice the modularity and explainability characteristic of real-world instruments like the classic Moog synthesizers. Furthermore, simplistic models frequently fail to capture complex modulations such as Frequency Modulation (FM) or Amplitude Modulation (AM).
The DiffMoog Framework
To bridge this gap, we introduce DiffMoog, a modular framework where every component is implemented as a differentiable operation. This allows for the integration of traditional sound synthesis directly into neural network training pipelines.
Modular Architecture
The synthesizer is organized as a 2D matrix of "cells," as shown in the architecture diagram below. Each cell can host a specific module, such as an Oscillator, LFO, Filter, or ADSR Envelope. This structure allows users to define custom "chains" to route signals between cells, mimicking the flexibility of physical modular hardware.
Encoder and Signal-Chain Loss
To perform sound matching, an audio input is processed by an encoder network (e.g., ResNet or GRU) that predicts the parameters for a specific DiffMoog configuration. A key innovation is the Signal-Chain Loss ($L_{SC}$). Unlike standard audio losses that only evaluate the final output, $L_{SC}$ evaluates the signal at every stage of the synthesis chain. This provides "early-stage" guidance to the optimizer, helping it identify which specific module in a long chain is responsible for discrepancies.
Key Insights: Overcoming the Frequency Trap
Estimating frequency using gradient descent is notoriously difficult because spectral loss surfaces are "spiky" and prone to local minima. Small errors in predicted frequency can lead to gradients that point in the wrong direction.
DiffMoog addresses this using the Wasserstein distance (Earth Mover's Distance) on the time axis of a spectrogram. This approach provides a smoother gradient that effectively "pushes" the predicted frequency toward the target, rather than merely penalizing the mismatch. Additionally, the framework employs the Gumbel-Softmax trick for categorical choices (like waveform type) and sigmoid functions for continuous parameter normalization to maintain differentiability.
Results and Evaluation
The framework was evaluated using custom synthetic datasets and the NSynth dataset. Key findings include:
- Wasserstein Superiority: In frequency perturbation tests, the Wasserstein-based loss consistently outperformed standard spectrogram and Mel-log losses.
- Successful Matching: Models trained on in-domain data were successfully fine-tuned on out-of-domain NSynth data, achieving high-fidelity reproductions of real-world instrument sounds.
- Explainability: Because DiffMoog uses standard modules, the predicted parameters are human-interpretable, allowing sound designers to understand the synthesis logic.
Limitations and Future Work
Despite these advancements, complex chains involving heavy FM modulation remain a challenge due to extremely chaotic loss surfaces. Achieving perfect imitation of highly textured auditory samples also remains difficult. Future research will focus on more refined audio loss functions and alternative neural architectures to better navigate the non-convex landscape of sound synthesis.
Code available at: https://github.com/aisynth/diffmoog
Summary updated