Bark<T>
Models & Types · AiDotNet.TextToSpeech.CodecBased
Beginner-friendly text façade over the shared BarkModel foundation model.
Inheritance: NeuralNetworkBase<T> → TtsModelBase<T> → BarkModel<T> → Bark<T>
Implements: ICodecTts<T>
How It Works
This type adds tokenizer loading and text-oriented synthesis. It inherits the one Bark neural implementation rather than constructing another layer stack, so the low-level and high-level APIs cannot drift in architecture, parameters, caching behavior, or checkpoint layout.
Constructors
| Constructor | Summary |
|---|---|
Bark(BarkOptions options, IAudioCodec<T> codec, ITokenizer tokenizer, int? seed) |
Creates Bark with an explicit architecture descriptor. |
Bark(NeuralNetworkArchitecture<T> architecture, BarkOptions options, IAudioCodec<T> codec, ITokenizer tokenizer) |
Creates Bark with an explicit architecture descriptor. |
Properties
| Property | Summary |
|---|---|
int MaxTextLength { get; } |
|
int NumCodebooks { get; } |
Methods
| Method | Summary |
|---|---|
BarkGenerationResult<T> SynthesizeDetailed(string text, BarkGenerationOptions generationOptions, BarkHistoryPrompt history, CancellationToken cancellationToken) |
Synthesizes text and returns semantic, coarse, fine, audio, and timing outputs. |
ModelMetadata<T> GetModelMetadata() |
|
Task<Tensor<T>> SynthesizeAsync(string text, BarkGenerationOptions generationOptions, BarkHistoryPrompt history, CancellationToken cancellationToken) |
Asynchronously synthesizes text with cooperative cancellation. |
Tensor<T> DecodeFromTokens(Tensor<T> tokens) |
|
Tensor<T> EncodeToTokens(Tensor<T> audio) |
|
Tensor<T> Synthesize(string text) |
Synthesizes a 24 kHz waveform from text using all four Bark stages. |