js-tts-wrapper
Version:
A JavaScript/TypeScript library that provides a unified API for working with multiple cloud-based Text-to-Speech (TTS) services
61 lines (60 loc) • 1.71 kB
TypeScript
import { AbstractTTSClient } from "../core/abstract-tts";
import type { SpeakOptions, TTSCredentials, UnifiedVoice } from "../types";
/**
* UpliftAI TTS Client Credentials
*/
export interface UpliftAITTSCredentials extends TTSCredentials {
/** UpliftAI API key */
apiKey?: string;
}
/**
* Extended options for UpliftAI TTS
*/
export interface UpliftAITTSOptions extends SpeakOptions {
/** Output format supported by UpliftAI */
outputFormat?: string;
/** Callback for end of speech */
onEnd?: () => void;
}
/**
* UpliftAI TTS Client
*/
export declare class UpliftAITTSClient extends AbstractTTSClient {
private apiKey;
private baseUrl;
private outputFormat;
protected sampleRate: number;
/**
* Create a new UpliftAI TTS client
* @param credentials Credentials including API key
*/
constructor(credentials?: UpliftAITTSCredentials);
/**
* Check if credentials are valid
*/
checkCredentials(): Promise<boolean>;
/**
* Get required credential field names
*/
protected getRequiredCredentials(): string[];
/**
* Get available voices (static list)
*/
protected _getVoices(): Promise<UnifiedVoice[]>;
/**
* Synthesize text to audio bytes
*/
synthToBytes(text: string, options?: UpliftAITTSOptions): Promise<Uint8Array>;
/**
* Synthesize text to a byte stream
*/
synthToBytestream(text: string, options?: UpliftAITTSOptions): Promise<{
audioStream: ReadableStream<Uint8Array>;
wordBoundaries: Array<{
text: string;
offset: number;
duration: number;
}>;
}>;
}
export default UpliftAITTSClient;