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

41 lines (40 loc) 1.48 kB
import { AbstractTTSClient } from "../core/abstract-tts"; import type { SpeakOptions, UnifiedVoice, WordBoundaryCallback } 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>; /** * Convert text to audio stream * @param text Text to synthesize * @param options Synthesis options * @returns Promise resolving to audio stream */ synthToBytestream(text: string, options?: SpeakOptions): Promise<ReadableStream<Uint8Array> | { audioStream: ReadableStream<Uint8Array>; wordBoundaries: Array<{ text: string; offset: number; duration: number; }>; }>; /** * 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>; }