generate_voiceover
Convert text to speech audio for narrated demos, returning an audio path and cache status so you can pace video recording to the speech duration.
Instructions
[Cinematic Engine - PHASE 1] Generate voiceover audio from text using TTS.
IMPORTANT: Call this FIRST before recording! Audio duration determines video pacing. Use get_audio_duration() to know exact timing.
Workflow:
generate_voiceover() -> get audio path
get_audio_duration() -> know timing (e.g., 8 seconds)
start_recording() -> record video paced to audio duration
Use ffmpeg via shell -> combine in post-production (see check_environment())
Lazy-loads the TTS client on first call. Caches audio files to avoid redundant API costs during retakes.
Args: text: The text to convert to speech provider: TTS provider - "openai" (default) or "elevenlabs" voice: Voice ID - OpenAI: alloy, echo, fable, onyx, nova, shimmer ElevenLabs recommended voices (natural, expressive): - "H2JKG8QcEaH9iUMauArc" (Abhinav - warm, natural male) - "qr9D67rNgxf5xNgv46nx" (Tarun - expressive male) speed: Speech speed multiplier (0.25 to 4.0, default 1.0)
ElevenLabs voice modulation (for natural, less robotic speech):
stability: Voice consistency (0.0-1.0). Lower = more expressive/variable,
higher = more consistent. Default 0.5. Try 0.3-0.4 for natural speech.
similarity_boost: Voice clarity (0.0-1.0). Higher = clearer but may sound
artificial. Default 0.75. Try 0.5-0.7 for natural speech.
style: Expressiveness/emotion (0.0-1.0). Higher = more emotive delivery.
Default 0. Try 0.2-0.5 for engaging narration. Only works with v2 models.
use_speaker_boost: Enhance speaker clarity (bool). Default True.
Can help with clarity but may reduce naturalness.Returns: {"success": True, "data": {"path": "/path/to/audio.mp3", "cached": bool}}
Example: # Natural, expressive voiceover vo = generate_voiceover( text="Welcome to our product demo.", provider="elevenlabs", voice="H2JKG8QcEaH9iUMauArc", # Abhinav - warm, natural stability=0.35, # More expressive similarity_boost=0.6, # Balanced clarity style=0.3 # Some emotion ) duration = get_audio_duration(vo["data"]["path"]) # Now record video paced to duration["data"]["duration_sec"]
Requires: pip install browser-director[video]
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"text": "<text>"
},
"name": "generate_voiceover"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| speed | No | ||
| style | No | ||
| voice | No | alloy | |
| provider | No | openai | |
| stability | No | ||
| similarity_boost | No | ||
| use_speaker_boost | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| hints | No | ||
| message | No | ||
| success | No | ||
| suggestions | No |