Text to speech
Converts text into spoken audio, and clones a new voice from caller-supplied audio samples — narration, dubbing, accessibility, IVR prompts.
Converts text into spoken audio, and clones a new voice from caller-supplied audio samples — narration, dubbing, accessibility, IVR prompts. Requires the caller's own ElevenLabs API key (BYOK) — see the 🔑 note on this unit.
Also known as: text to speech, voice cloning, text to speech voice cloning, tts, synthesize speech, clone a voice, convert text to audio, narration, voiceover generator, AI voice
Call it
bowmark.text_to_speech.synthesize(text: string, options?: SynthesizeOptions): Promise<SynthesizeResult>
bowmark.text_to_speech.cloneVoice(options: CloneVoiceOptions): Promise<CloneVoiceResult>Functions
| Function | What it does |
|---|---|
synthesize | Converts text into spoken audio, base64-encoded, in an existing or previously-cloned voice (options.voiceId, defaulting to a standard voice). Requires an API key — a caller with none… |
cloneVoice | Creates a new voice cloned from one or more audio sample URLs (options.sampleUrls) — downloads each sample and uploads it to the vendor's cloning endpoint. |
Types
interface SynthesizeOptions {
voiceId?: string // an id cloneVoice returned, or the vendor's own default voice
}
interface SynthesizeResult {
audioBase64: string // the synthesized audio, base64-encoded
contentType: string // e.g. "audio/mpeg"
voiceId: string
warnings: string[]
}
interface CloneVoiceOptions {
name: string
sampleUrls: string[] // audio sample URLs to clone the voice from
description?: string
}
interface CloneVoiceResult {
voiceId: string // pass this as SynthesizeOptions.voiceId
name: string
requiresVerification: boolean
warnings: string[]
}
type CallOptions = {
timeoutMs?: number // per-provider budget in ms, default 30000, clamped to 1000-55000.
// A provider slower than this is DROPPED from the results and
// NAMED in warnings — never silently absent
}Examples
const speech = await bowmark.text_to_speech.synthesize("Hello there");
// speech -> { audioBase64: "SUQzBAAAAAAAI1RTU0U…", contentType: "audio/mpeg", voiceId: "21m00Tcm4TlvDq8ikWAM", warnings: [] }const voice = await bowmark.text_to_speech.cloneVoice({
name: "Narrator",
sampleUrls: ["https://example.com/samples/narrator-01.mp3"],
});
const speech = await bowmark.text_to_speech.synthesize("In a cloned voice.", { voiceId: voice.voiceId });Providers behind it
| Provider | |
|---|---|
elevenlabs | ElevenLabs |