BarkOptions
Options & Configuration · AiDotNet.TextToSpeech.CodecBased
Options for the Suno Bark text-prompted generative audio architecture.
Inheritance: ModelOptions → TtsModelOptions → CodecTtsOptions → BarkOptions
For Beginners
You normally do not need to change these values. A checkpoint was trained for one exact configuration, so the model validates all connected dimensions for you and reports the setting that is wrong.
How It Works
Defaults match the public Bark checkpoints: three 24-layer, 1,024-wide transformers; a
10,000-token semantic vocabulary; two coarse and eight total EnCodec codebooks at 24 kHz.
Construction remains allocation-light because transformer and embedding weights are lazy.
Use TinyForTests for fast conformance tests without changing the topology.
Constructors
| Constructor | Summary |
|---|---|
BarkOptions() |
Creates the paper/checkpoint-faithful full configuration. |
BarkOptions(BarkOptions other) |
Creates an independent copy. |
Properties
| Property | Summary |
|---|---|
BarkStageOptions Coarse { get; set; } |
Coarse-acoustic transformer configuration. |
BarkStageOptions Fine { get; set; } |
Fine-acoustic transformer configuration. |
BarkStageOptions Semantic { get; set; } |
Semantic transformer configuration. |
bool UseKeyValueCache { get; set; } |
Use incremental KV-cached decoding for causal stages. |
double CoarseRateHz { get; set; } |
Coarse EnCodec frame rate. |
double SemanticRateHz { get; set; } |
Semantic token rate from the HuBERT tokenizer. |
int CoarseHistoryLength { get; set; } |
Maximum flattened coarse history tokens. |
int CoarseInferenceTokenId { get; set; } |
Token that asks the coarse model to begin generation. |
int CoarseSemanticContextLength { get; set; } |
Fixed semantic section prepended to each coarse generation window. |
int CoarseSemanticPadTokenId { get; set; } |
Semantic padding token in the coarse model vocabulary. |
int CoarseSlidingWindowLength { get; set; } |
Coarse tokens retained when advancing the sliding context. |
int FineWindowLength { get; set; } |
Fine transformer window length. |
int FineWindowStride { get; set; } |
Fine transformer window stride. |
int MaxSemanticNewTokens { get; set; } |
Maximum semantic tokens generated for one request. |
int NumberOfCoarseCodebooks { get; set; } |
Number of autoregressively generated coarse codebooks. |
int NumberOfFineCodebooksGiven { get; set; } |
Fine codebooks supplied rather than predicted. |
int SamplingSeed { get; set; } |
The seed of the generator each generation draws its samples from (one generator per request, shared by its stages), so the same text and options synthesize the same audio. |
int SemanticHistoryLength { get; set; } |
Maximum semantic history tokens included in a prompt. |
int SemanticInferenceTokenId { get; set; } |
Token that asks the semantic model to begin generation. |
int SemanticPadTokenId { get; set; } |
Semantic padding token. |
int SemanticVocabularySize { get; set; } |
Number of actual semantic audio tokens (special tokens are outside this range). |
int TextEncodingOffset { get; set; } |
Offset applied to BERT text token ids in the semantic model’s combined vocabulary. |
int TextPadTokenId { get; set; } |
Padding token used for the fixed 256-token BERT text section. |
string TokenizerModelName { get; set; } |
Hugging Face tokenizer paired with the released multilingual Bark checkpoints. |
Methods
| Method | Summary |
|---|---|
BarkOptions TinyForTests(int seedVocabulary) |
Returns a topology-faithful tiny configuration for unit tests and examples. |
void Validate() |
Validates the complete connected Bark contract. |