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

42 lines (41 loc) 1.51 kB
import { AbstractTTSClient } from "../core/abstract-tts"; import type { SpeakOptions, TTSCredentials, UnifiedVoice } from "../types"; /** * eSpeak TTS Client for Node.js environments * * This client uses the text2wav package for server-side eSpeak TTS synthesis. * For browser environments, use EspeakBrowserTTSClient instead. */ export declare class EspeakNodeTTSClient extends AbstractTTSClient { constructor(credentials?: TTSCredentials); /** * eSpeak does not require credentials in Node.js */ checkCredentials(): Promise<boolean>; /** * Synthesize text to audio bytes (Uint8Array) * @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 byte stream (ReadableStream) * @param text Text to synthesize * @param options Synthesis options * @returns Promise resolving to an object containing the audio stream and an empty word boundaries array. */ synthToBytestream(text: string, options?: SpeakOptions): Promise<{ audioStream: ReadableStream<Uint8Array>; wordBoundaries: Array<{ text: string; offset: number; duration: number; }>; }>; /** * Return available voices for eSpeak */ _getVoices(): Promise<UnifiedVoice[]>; } export { EspeakNodeTTSClient as EspeakTTSClient };