AudioGenOptions

Options & Configuration · AiDotNet.Audio.AudioGen

Configuration options for audio generation models.

Inheritance: ModelOptions → NeuralNetworkOptions → ModelHyperparameterOptions → AudioNeuralNetworkOptions → AudioGenOptions

For Beginners

AudioGen works differently from TTS:

  • TTS: Converts specific text to spoken words
  • AudioGen: Creates sounds/music matching a description

Example prompts:

  • “A dog barking in the distance”
  • “Gentle piano music with rain sounds”
  • “Crowd cheering at a sports event”

How It Works

AudioGen models generate audio from text descriptions using a language model approach with discrete audio codes (like EnCodec).

Constructors

Constructor Summary
AudioGenOptions() Initializes a new instance with default values.
AudioGenOptions(AudioGenOptions other) Initializes a new instance by copying from another instance.

Properties

Property Summary
AudioGenModelSize ModelSize { get; set; } Gets or sets the model size to use.
OnnxModelOptions OnnxOptions { get; set; } Gets or sets the ONNX execution options.
double DurationSeconds { get; set; } Gets or sets the duration of generated audio in seconds.
double GuidanceScale { get; set; } Gets or sets the classifier-free guidance scale.
double MaxDurationSeconds { get; set; } Gets or sets the maximum duration in seconds.
double Temperature { get; set; } Gets or sets the temperature for sampling.
double TopP { get; set; } Gets or sets the top-p (nucleus) value for sampling.
int Channels { get; set; } Gets or sets the number of audio channels (1=mono, 2=stereo).
int CodebookSize { get; set; } Gets or sets the number of entries in each EnCodec codebook.
int EncodecDimension { get; set; } Gets or sets the EnCodec latent dimension D, the width of each codebook entry.
int EncodecFilters { get; set; } Gets or sets the SEANet base channel count C; the decoder’s widest layer is C times 2 to the number of upsampling stages.
int EncodecLstmLayers { get; set; } Gets or sets the number of LSTM layers in the SEANet decoder.
int LmHiddenDim { get; set; } Gets or sets the lm hidden dim.
int MaxTextLength { get; set; } Gets or sets the max text length.
int NumCodebooks { get; set; } Gets or sets the num codebooks.
int NumHeads { get; set; } Gets or sets the num heads.
int NumLmLayers { get; set; } Gets or sets the num lm layers.
int SampleRate { get; set; } Gets or sets the output sample rate in Hz.
int TextHiddenDim { get; set; } Gets or sets the text hidden dim.
int TopK { get; set; } Gets or sets the top-k value for sampling.
string EncodecWeightsPath { get; set; } Gets or sets the path of a pretrained EnCodec checkpoint (safetensors, audiocraft state-dict names) whose decoder and codebooks the native model decodes with; null keeps the seeded initialization.

Methods

Method Summary
void Validate() Throws if a value this model requires has been left unset or is not positive.