/** * Text-to-speech provider surface. fabric-harness ships ElevenLabs and * Cartesia implementations; bring-your-own for on-prem TTS or unsupported * vendors. Used by `PipelineVoiceProvider` to drive the audio-out side of * STT→LLM→TTS voice agents. * * For monolithic realtime models that own audio in *and* out (OpenAI * Realtime), use `OpenAIRealtimeVoiceProvider` directly — TTS is internal. */ import type { VoiceAudioFormat } from './voice.js'; export interface TtsSynthesisOptions { /** Voice timbre / cloned-voice id. Provider-specific. */ voice?: string; /** Audio format on the wire. Default `pcm16`. */ audioFormat?: VoiceAudioFormat; /** Sample rate in Hz. Default 24000 for `pcm16`, 8000 for telephony codecs. */ sampleRate?: number; /** Optional speaking-rate / speed multiplier (1.0 = default). */ speed?: number; /** Abort signal — terminates an in-flight synthesis cleanly. */ signal?: AbortSignal; } export interface TtsSynthesisUsage { /** Characters of input text submitted (used for billing rollup). */ characters: number; /** Total bytes of audio emitted. */ audioBytes: number; /** Wall-clock duration of the synthesis call in milliseconds. */ durationMs: number; } export interface TtsProvider { /** Stable provider id used in cost telemetry, e.g. `elevenlabs`, `cartesia`. */ readonly name: string; /** * Synthesize a complete utterance. Yields raw audio frames in * `opts.audioFormat` (default `pcm16`). The final iteration value is * the usage rollup — read it from `provider.lastUsage()` when the * iterator completes. */ synthesize(text: string, opts?: TtsSynthesisOptions): AsyncIterable; /** * Optional: streaming text input. The provider should chunk audio out * incrementally as text arrives — useful for low-latency LLM-token-to- * audio paths. Falls back to buffering + `synthesize()` if absent. */ synthesizeStream?(text: AsyncIterable, opts?: TtsSynthesisOptions): AsyncIterable; /** Last completed synthesis usage. Reset at the start of each call. */ lastUsage(): TtsSynthesisUsage | undefined; } //# sourceMappingURL=voice-tts.d.ts.map