WaveGradOptions
Options & Configuration · AiDotNet.TextToSpeech.Vocoders
Options for WaveGrad (Chen et al. 2021): a diffusion vocoder that conditions its noise predictor on the continuous noise level √ᾱ, so one trained model samples with any inference schedule.
Inheritance: ModelOptions → TtsModelOptions → VocoderOptions → WaveGradOptions
For Beginners
These options configure the WaveGrad model. Default values follow the original paper settings.
How It Works
Defaults are the paper’s WaveGrad Base conditioned on the continuous noise level (§2.2, §4, App. A–B): 24 kHz
audio, 128 mel bands from a 2048-point FFT with a 50 ms window and a 12.5 ms hop, 20 Hz to 12 kHz; UBlocks
upsampling 5, 5, 3, 2, 2 with 512, 512, 256, 128, 128 channels and dilations 1, 2, 4, 8 in the first three and
1, 2, 1, 2 in the rest; mirrored DBlocks with dilations 1, 2, 4; a 5×1 convolution of 32 channels over the waveform
and a 3×1 convolution of 768 over the mel spectrogram; the noise level scaled by C = 5000 in the positional
encoding; S = 1000 training levels from the β schedule Linear(1e-6, 0.01, 1000), a level drawn uniformly between
two neighbouring ones; the L1 loss; 24-frame (7,200-sample) crops at batch 256. Large builds
WaveGrad Large.
What the paper leaves open follows lmnt-com/wavegrad: Adam at 2e-4, the gradient norm clipped to 1; leaky
ReLU 0.2; features from torchaudio (centred, window-normalized magnitude, HTK bands) as
clamp((20 log10(max(x, 1e-5)) − 20 + 100) / 100, 0, 1); each sampling step clamped to [−1, 1]; synthesis over
the training schedule unless InferenceNoiseSchedule is set. The paper’s six-iteration schedule was
found by a grid search over {1, …, 9} × 10^{−6 … −1} per step (App. B) and its values are not published.
Constructors
| Constructor | Summary |
|---|---|
WaveGradOptions() |
Creates the paper’s WaveGrad Base configuration. |
WaveGradOptions(WaveGradOptions other) |
Initializes a new instance by copying from another instance. |
Properties
| Property | Summary |
|---|---|
bool RepeatBlocks { get; set; } |
Gets or sets whether each UBlock and DBlock is followed by a non-resampling one (WaveGrad Large). |
double GradientClipNorm { get; set; } |
Gets or sets the global gradient-norm clip of a training step (1). |
double LeakySlope { get; set; } |
Gets or sets the leaky-ReLU slope (0.2). |
double MelMaxFrequency { get; set; } |
Gets or sets the highest mel frequency (12 kHz). |
double MelMinFrequency { get; set; } |
Gets or sets the lowest mel frequency (20 Hz). |
double NoiseLevelScale { get; set; } |
Gets or sets the linear scale C of the noise level in the positional encoding (5000). |
double[] InferenceNoiseSchedule { get; set; } |
Gets or sets the inference β schedule, or null to sample with NoiseSchedule. |
double[] NoiseSchedule { get; set; } |
Gets or sets the β schedule whose S noise levels the training draws between (Linear(1e-6, 0.01, 1000)). |
int CropFrames { get; set; } |
Gets or sets the mel frames of a training crop (24). |
int HopSize { get; set; } |
The actual product of the UBlock upsampling factors (300 samples in the paper). |
int MelProjectionChannels { get; set; } |
Gets or sets the channels of the 3×1 convolution over the mel spectrogram (768). |
int SamplingSeed { get; set; } |
Gets or sets the seed of the training draws and of the synthesis noise. |
int WaveformChannels { get; set; } |
Gets or sets the channels of the 5×1 convolution over the noisy waveform (32). |
int WindowSize { get; set; } |
Gets or sets the analysis window of the input features (1200: 50 ms). |
int[] UpsampleChannels { get; set; } |
Gets or sets the UBlocks’ output channels (512, 512, 256, 128, 128). |
int[] UpsampleFactors { get; set; } |
Gets or sets the UBlocks’ upsampling factors (5, 5, 3, 2, 2; their product is the hop). |
int[][] UpsampleDilations { get; set; } |
Gets or sets the four dilations of each UBlock (1, 2, 4, 8 for the first three; 1, 2, 1, 2 after). |
Methods
| Method | Summary |
|---|---|
WaveGradOptions Large() |
WaveGrad Large (§4): every UBlock and DBlock followed by one that does not resample, dilations 1, 2, 4, 8 in every UBlock, 60-frame (18,000-sample) crops. |
double[] Linear(double from, double to, int count) |
Values linearly spaced from from to to (numpy linspace). |