/** * Voice TTS module — manages Piper subprocess for text-to-speech. * * Sentence buffering: accumulates tokens until sentence boundary, * then pipes each sentence to Piper and streams raw PCM back. * * Audio format: 16-bit signed PCM, 22050 Hz, mono. */ export declare const SAMPLE_RATE = 22050; export declare const CHANNELS = 1; export declare const BIT_DEPTH = 16; /** * Buffers streaming tokens into complete sentences for TTS. */ export declare class SentenceBuffer { private buffer; private onSentence; constructor(onSentence: (sentence: string) => void); /** Add a token to the buffer. Flushes complete sentences. */ push(token: string): void; /** Flush any remaining text in the buffer. */ flush(): void; /** Clear the buffer without flushing. */ clear(): void; } /** * Check if Piper and the specified voice are available. */ export declare function isPiperAvailable(voice?: string): boolean; export interface VoiceTTSSessionOptions { voice?: string; /** Called with raw PCM chunks (16-bit signed, 22050 Hz, mono) */ onAudio: (pcm: Buffer) => void; /** Called when all queued sentences have been spoken */ onDone: () => void; /** Called on error */ onError?: (err: Error) => void; } /** * Manages a voice TTS session — buffers tokens into sentences, * synthesizes each with Piper, and streams PCM audio back. */ export declare class VoiceTTSSession { private voice; private sentenceBuffer; private queue; private processing; private aborted; private finished; private doneFired; private onAudio; private userOnDone; private onError; private activeProc; private completionPromise; private resolveCompletion; constructor(opts: VoiceTTSSessionOptions); /** Feed a streaming token into the session. */ pushToken(token: string): void; /** Signal that no more tokens will arrive. Flushes remaining buffer. */ finish(): void; /** Abort the session — stop all synthesis immediately. */ abort(): void; /** * Resolves when the session is fully complete: all sentences synthesized * (onDone fired) OR the session was aborted. Lets callers wait for voice * playback to be fully delivered before tearing down the WebSocket binding. */ waitForCompletion(): Promise; private fireDone; private processQueue; private synthesizeSentence; } //# sourceMappingURL=voice-tts.d.ts.map