import { Cartesia } from "../client.js"; import { BackCompatRequestOptions } from "./types.js"; import type { Readable } from 'stream'; export interface BackCompatWebSocketOptions { container?: 'raw' | 'wav' | 'mp3'; encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw'; sampleRate: number; } export type BackCompatTtsRequestVoiceSpecifier = { mode: 'id'; id: string; } | { mode: 'embedding'; embedding: number[]; }; export interface BackCompatGenerationConfig { volume?: number; speed?: number; emotion?: string[]; } export interface BackCompatWebSocketTtsRequest { modelId: string; transcript: string; voice: BackCompatTtsRequestVoiceSpecifier; generationConfig?: BackCompatGenerationConfig; outputFormat?: { container?: 'raw' | 'wav' | 'mp3'; encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw'; sampleRate?: number; bitRate?: number; }; contextId?: string; continue?: boolean; duration?: number; addTimestamps?: boolean; addPhonemeTimestamps?: boolean; } export interface BackCompatTtsRequest { modelId: string; transcript: string; voice: BackCompatTtsRequestVoiceSpecifier; language?: string; outputFormat: { container: 'raw' | 'wav' | 'mp3'; encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw'; sampleRate: number; bitRate?: number; }; generationConfig?: BackCompatGenerationConfig; duration?: number; speed?: 'slow' | 'normal' | 'fast'; pronunciationDictId?: string; } declare class AudioSource { private buffers; private waiter; isDone: boolean; push(data: Buffer): void; markDone(): void; read(outBuffer: Float32Array): Promise; } export declare class WebSocketWrapper { private client; private config; private socket; private sources; private defaultSource; constructor(client: Cartesia, config: BackCompatWebSocketOptions); connect(): Promise; private handleMessage; send(request: BackCompatWebSocketTtsRequest): Promise<{ source: AudioSource; }>; disconnect(): void; } export interface BackCompatTtsGenerateOptions { modelId?: string; outputFormat?: { container: 'raw' | 'wav' | 'mp3'; encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw'; sampleRate: number; bitRate?: number; }; language?: string; generationConfig?: BackCompatGenerationConfig; speed?: 'slow' | 'normal' | 'fast'; pronunciationDictId?: string; } /** @deprecated Use the new SDK's tts methods on the {@link Cartesia} instance instead. */ export declare class TTSWrapper { private client; constructor(client: Cartesia); /** @deprecated Use {@link Cartesia.tts.websocket} instead. */ websocket(config: BackCompatWebSocketOptions): WebSocketWrapper; /** * Generate speech from text. * @param transcript The text to convert to speech * @param voiceId The voice ID to use * @param options Generation options * @param signal Optional abort signal * @param _source Optional source identifier (e.g., "playground_tts") - for tracking purposes * @deprecated Use {@link Cartesia.tts.generate} instead. */ generate(transcript: string, voiceId: string, options?: BackCompatTtsGenerateOptions, signal?: AbortSignal, _source?: string): Promise; /** @deprecated Use {@link Cartesia.tts.generate} instead. */ bytes(request: BackCompatTtsRequest, requestOptions?: BackCompatRequestOptions): Promise; } export {}; //# sourceMappingURL=tts-wrapper.d.ts.map