Skip to content
Tracon

ISpeechSynthesizer

Namespace Tracon · Assembly Tracon.Abstractions.dll

A provider that generates speech from text.

public interface ISpeechSynthesizer

ElevenLabs is an implementation, not a dependency. A consumer wanting another provider registers their own implementation; tools know only this contract.

The contract lives HERE, not in Tracon.Voice: the HTTP layer (Tracon.AspNetCore) sees these types while serving the voice endpoints, but it CANNOT reference Tracon.Voice (the package direction rule). The same pattern was applied to the MCP abstractions —.

DI lifetime — singleton. Registered as a singleton with TryAdd; a consumer’s own registration wins.

Tenant behavior — TENANT-INDEPENDENT. The provider and its credentials are configured once, process-wide — voice is not part of the per-tenant BYOK credential system the text model providers use; no member here takes a tenant parameter.

The maximum number of characters accepted in a single ISpeechSynthesizer.SynthesizeAsync call.

int MaxCharactersPerRequest { get; }

int

The tool call (speak) AND the direct HTTP operator endpoint (POST /api/voice/speak) read the SAME value — the limit is applied consistently across both paths.

The provider name. Used in cost records and health checks.

string ProviderName { get; }

string

Lists the available voices.

ValueTask<IReadOnlyList<VoiceDescriptor>> ListVoicesAsync(CancellationToken cancellationToken = default)

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<VoiceDescriptor>>

The voices, ordered by name.

SynthesizeAsync(SpeechRequest, CancellationToken)

Section titled “ SynthesizeAsync(SpeechRequest, CancellationToken)”

Synthesizes speech from a text.

ValueTask<SpeechAudio> SynthesizeAsync(SpeechRequest request, CancellationToken cancellationToken = default)

request SpeechRequest

The request.

cancellationToken CancellationToken

The cancellation token.

ValueTask<SpeechAudio>

The generated audio.

SynthesizeStreamingAsync(SpeechRequest, CancellationToken)

Section titled “ SynthesizeStreamingAsync(SpeechRequest, CancellationToken)”

Synthesizes speech from a text and streams the audio piece by piece.

IAsyncEnumerable<ReadOnlyMemory<byte>> SynthesizeStreamingAsync(SpeechRequest request, CancellationToken cancellationToken = default)

request SpeechRequest

The request.

cancellationToken CancellationToken

The cancellation token.

IAsyncEnumerable<ReadOnlyMemory<byte>>

The audio chunks.

The streaming path is for low latency, and the voice layer uses it. The signature is defined now: adding a member to an interface later is a breaking change for consumers implementing that interface.

Streamed audio is not stored as an attachment. The billed quantity is unknown until the stream ends, and the chunks are not a valid file on their own; the speak tool uses the non-streaming path for this reason.