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.5 kB
TypeScript
import { AbstractTTSClient } from "../core/abstract-tts";
import type { SpeakOptions, TTSCredentials, UnifiedVoice } from "../types";
export interface FishAudioTTSOptions extends SpeakOptions {
model?: string;
voice?: string;
providerOptions?: Record<string, unknown>;
}
export interface FishAudioTTSCredentials extends TTSCredentials {
apiKey?: string;
baseURL?: string;
model?: string;
properties?: Record<string, unknown> | string;
propertiesJson?: string;
}
export declare class FishAudioTTSClient extends AbstractTTSClient {
private apiKey;
private baseUrl;
private model;
constructor(credentials?: FishAudioTTSCredentials);
private applyCredentialProperties;
private processAudioTags;
private prepareText;
setModel(model: string): void;
setVoice(voiceId: string): void;
getProperty(property: string): any;
setProperty(property: string, value: any): void;
checkCredentials(): Promise<boolean>;
protected getRequiredCredentials(): string[];
protected _getVoices(): Promise<any[]>;
protected _mapVoicesToUnified(rawVoices: any[]): Promise<UnifiedVoice[]>;
synthToBytes(text: string, options?: FishAudioTTSOptions): Promise<Uint8Array>;
synthToBytestream(text: string, options?: FishAudioTTSOptions): Promise<{
audioStream: ReadableStream<Uint8Array>;
wordBoundaries: Array<{
text: string;
offset: number;
duration: number;
}>;
}>;
}