CloudTtsClientBase<T>

Base Classes · AiDotNet.TextToSpeech.ProprietaryAPI

A client of a hosted text-to-speech service: it sends the text to the service’s REST API and decodes the audio it returns into a waveform tensor.

Implements: IDisposable, ITtsModel<T>

Known derived types: AmazonPolly<T>, AzureNeuralTTS<T>, ElevenLabsTTS<T>, GoogleCloudTTS<T>, Murf<T>, NVIDIARivaTTS<T>, WellSaidLabs<T>

For Beginners

Call Synthesize with your text; the class sends it to the vendor over the internet with your API key and gives you back the audio samples.

How It Works

These services are proprietary systems with no published architecture to reproduce, so the faithful implementation is a client of the service itself. A request is retried after a rate limit (429) or a server error (5xx), honouring the service’s Retry-After header, otherwise after an exponentially growing delay. The waveform is mono, in [−1, 1], at the sample rate the service was asked for.

Properties

Property Summary
int MaxTextLength { get; }
int SampleRate { get; }
string ProviderName { get; } The service’s name, used in messages.

Methods

Method Summary
Task<Tensor<T>> SynthesizeAsync(string text, CancellationToken cancellationToken) Synthesizes text through the service.
Tensor<T> Synthesize(string text)
void Dispose() Releases the HTTP client when the client created it.