UNPKG

js-tts-wrapper

Version:

A JavaScript/TypeScript library that provides a unified API for working with multiple cloud-based Text-to-Speech (TTS) services

37 lines (36 loc) 1.45 kB
import { AbstractTTSClient } from "../core/abstract-tts"; import type { SpeakOptions, UnifiedVoice, WordBoundaryCallback, WordBoundary } from "../types"; /** * Mock TTS client for testing */ export declare class MockTTSClient extends AbstractTTSClient { /** * Get available voices (internal implementation) * @returns Promise resolving to an array of unified voice objects */ protected _getVoices(): Promise<UnifiedVoice[]>; /** * Convert text to audio bytes * @param _text Text to synthesize * @param _options Synthesis options * @returns Promise resolving to audio bytes */ synthToBytes(_text: string, _options?: SpeakOptions): Promise<Uint8Array>; /** * Synthesize text to a readable byte stream. * @param text The text to synthesize. * @param options Synthesis options. * @returns Promise resolving to an object containing the audio stream and word boundaries. */ synthToBytestream(text: string, options?: SpeakOptions): Promise<{ audioStream: ReadableStream<Uint8Array>; wordBoundaries: WordBoundary[]; }>; /** * Start playback with word boundary callbacks * @param text Text to speak * @param callback Callback function for word boundaries * @param _options Synthesis options */ startPlaybackWithCallbacks(text: string, callback: WordBoundaryCallback, _options?: SpeakOptions): Promise<void>; }