js-tts-wrapper
Version:
A JavaScript/TypeScript library that provides a unified API for working with multiple cloud-based Text-to-Speech (TTS) services
43 lines (42 loc) • 1.58 kB
TypeScript
import { AbstractTTSClient } from "../core/abstract-tts";
import type { SpeakOptions, TTSCredentials, UnifiedVoice } from "../types";
/**
* eSpeak TTS client for browser environments using meSpeak.js
* This provides eSpeak functionality in browsers and Node.js via WebAssembly
* For Node.js-only environments with better performance, use EspeakNodeTTSClient instead.
*/
export declare class EspeakBrowserTTSClient extends AbstractTTSClient {
constructor(credentials?: TTSCredentials);
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 WASM
*/
_getVoices(): Promise<UnifiedVoice[]>;
/**
* Check if credentials are valid (eSpeak doesn't need credentials)
*/
checkCredentials(): Promise<boolean>;
/**
* Get detailed credential validation info
*/
checkCredentialsAdvanced(): Promise<{
valid: boolean;
message: string;
details?: Record<string, any>;
}>;
}
export { EspeakBrowserTTSClient as EspeakWasmTTSClient };