import type { StorageAdapter } from './storage-adapter.js'; import type { TextToSpeechResult } from './types.js'; type AudioFormat = 'mp3' | 'opus' | 'aac' | 'flac' | 'wav'; /** * Fluent builder for text-to-speech generation. * * @example * const result = await AudioGenerator.of('Hello world').voice('alloy').generate() * await AudioGenerator.of('Hello').format('wav').store('audio/greeting.wav', storage) * * @example Failover across providers * const result = await AudioGenerator.of('Hello') * .model('openai/tts-1-hd') * .failover('elevenlabs/eleven_multilingual_v2') * .generate() */ export declare class AudioGenerator { private readonly _text; private _model?; private _voice?; private _speed?; private _format?; private _failover; private constructor(); /** Create an AudioGenerator for the given text */ static of(text: string): AudioGenerator; /** Set the TTS model (e.g. 'openai/tts-1-hd') */ model(m: string): this; /** * Provider/model strings to try if the primary fails. * Tried in order; the first to succeed wins. */ failover(...models: string[]): this; /** Set the voice (e.g. 'alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer') */ voice(v: string): this; /** Set playback speed (0.25 to 4.0) */ speed(s: number): this; /** Set output audio format */ format(f: AudioFormat): this; /** Generate the audio */ generate(): Promise; /** * Generate audio and persist it through a caller-supplied * {@link StorageAdapter}. Returns the `path` it was stored at. * * ```ts * import { writeFile } from 'node:fs/promises' * await AudioGenerator.of('Hello') * .store('audio/greeting.wav', { put: (p, bytes) => writeFile(p, bytes) }) * ``` */ store(path: string, storage: StorageAdapter): Promise; } export {}; //# sourceMappingURL=audio.d.ts.map