DiffWaveOptions

Options & Configuration · AiDotNet.TextToSpeech.Vocoders

Options for DiffWave (Kong et al. 2021): a diffusion vocoder whose noise predictor is a non-autoregressive, bidirectional dilated-convolution network conditioned on the mel spectrogram.

Inheritance: ModelOptions → TtsModelOptions → VocoderOptions → DiffWaveOptions

Known derived types: PriorGradOptions

For Beginners

These options configure the DiffWave model. Default values follow the original paper settings.

How It Works

Defaults are the paper’s DiffWave BASE with T = 50 (§5.1, Table 1): 30 residual layers of C = 64 channels, kernel 3, dilation cycle 1, 2, …, 512; a linear β schedule from 1e-4 to 0.05 over 50 steps; 22.05 kHz audio, 80 mel bands from a 1024-point FFT with hop 256; the mel upsampled ×256 by two transposed 2-D convolutions of stride 16 and (3, 32) kernels with leaky ReLU 0.4; Adam at 2e-4, batch 16, about 16,000-sample clips; the fast-sampling schedule 1e-4, 1e-3, 0.01, 0.05, 0.2, 0.5 (App. B; set UseFastSampling).

What the paper leaves open follows lmnt-com/diffwave (params.py, preprocess.py): 62-frame crops; mel features from torchaudio (centred, window-normalized magnitude, HTK bands from 20 Hz to Nyquist, a 1024-sample window) as clamp((20 log10(max(x, 1e-5)) − 20 + 100) / 100, 0, 1); each sampling step clamped to [−1, 1]; no gradient clipping. The paper’s L2 noise loss is used (the reference’s code uses L1).

The paper’s other two tasks have their own configurations: Unconditional (§5.2) and ClassConditional (§5.3). Both generate whole utterances (the paper trains on full one-second SC09 clips), so a model input is the class label (or, unconditionally, ignored) rather than a spectrogram.

Constructors

Constructor Summary
DiffWaveOptions() Creates the paper’s DiffWave BASE (T = 50) configuration.
DiffWaveOptions(DiffWaveOptions other) Initializes a new instance by copying from another instance.

Properties

Property Summary
DiffWaveConditioner Conditioner { get; set; } Gets or sets what the noise predictor is conditioned on (the mel spectrogram).
bool UseFastSampling { get; set; } Gets or sets whether synthesis uses the fast-sampling schedule (false: the training schedule).
double MelMinFrequency { get; set; } Gets or sets the lowest mel frequency (20 Hz).
double[] InferenceNoiseSchedule { get; set; } Gets or sets the fast-sampling β schedule (1e-4, 1e-3, 0.01, 0.05, 0.2, 0.5).
double[] NoiseSchedule { get; set; } Gets or sets the training β schedule (50 values linearly spaced from 1e-4 to 0.05).
int CropFrames { get; set; } Gets or sets the mel frames of a training crop (62).
int DilationCycle { get; set; } Gets or sets the dilation cycle length (10: dilations 1 … 512).
int HiddenDim { get; set; } The actual residual denoiser width (64 for vocoding, 256 for the paper’s utterance models).
int HopSize { get; set; } The product of the mel conditioner’s even transposed-convolution strides.
int NumClasses { get; set; } Gets or sets the number of labels of the class conditioner (no default: it is the dataset’s; SC09 has 10 digits).
int NumResLayers { get; set; } Gets or sets the residual layers N (30).
int ResChannels { get; set; } Gets or sets the residual channels C (64 for BASE; 128 for LARGE).
int SamplingSeed { get; set; } Gets or sets the seed of the training draws and of the synthesis noise.
int UtteranceSamples { get; set; } Gets or sets the length L of a generated utterance without a spectrogram (16,000 in §5.2).
int WindowSize { get; set; } Gets or sets the analysis window of the input features (1024).
int[] UpsampleStrides { get; set; } Gets or sets the spectrogram upsampler’s strides (16, 16: their product is the hop).

Methods

Method Summary
DiffWaveOptions ClassConditional(int numClasses) The paper’s class-conditional configuration (§5.3): the unconditional model’s hyperparameters with a shared 128-wide embedding of one of numClasses labels (10 digits for SC09) added in every residual layer.
DiffWaveOptions Unconditional() The paper’s unconditional generation configuration (§5.2): 16 kHz one-second utterances (L = 16,000), 36 residual layers of C = 256 channels, dilation cycle 1, 2, …, 2048, T = 200 steps with β linear from 1e-4 to 0.02, sampled over the full…
double[] Linear(double from, double to, int count) Values linearly spaced from from to to (numpy linspace).