gemini-tts
Generate speech and voiceovers with Google Gemini TTS for narration, podcasts, and product video voice tracks.
Install
npx skills add https://github.com/memex-lab/product-launch-video-skill --skill gemini-tts- license
- MIT
- compatibility
- Requires Node.js 18+, ffmpeg, and internet access. Set GEMINI_API_KEY env var.
- metadata
- {"openclaw": {"requires": {"env": ["GEMINI_API_KEY"]}, "primaryEnv": "GEMINI_API_KEY"}}
Gemini Text-to-Speech
Generate natural, expressive speech from text using Google Gemini TTS. Supports 70+ languages, 30 prebuilt voices, and style control via natural language prompts and audio tags.
Requirements: Node.js 18+, ffmpeg,
@google/genainpm package,GEMINI_API_KEYenv var.
Available Scripts
scripts/generate-tts.mjs— All-in-one TTS generator with single-request consistency, silence-based splitting, and automatic trimming.
Quick Start
Single text to speech
Multi-segment voiceover (consistent voice)
Create a segments.json:
Run:
Output (JSON to stdout):
Script Options
Exit Codes
How It Works (Multi-Segment)
Gemini TTS does NOT guarantee voice consistency across separate API requests. The script solves this by:
- Combining all segments into ONE prompt with
[3 second pause]markers between them - Generating a single continuous audio file in one API call
- Detecting silence gaps with ffmpeg
silencedetectusing adaptive thresholds (starts at noise=-35dB, d=1.5s, progressively relaxes). If an exact match is found, uses it directly. If a threshold jump occurs (too few → too many), regenerates audio with faster speech pacing to make inter-segment pauses more distinct, then retries detection. - Splitting at silence midpoints into individual segment files
- Trimming residual silence padding (~1.5s per side) from each segment, keeping 0.15s breathing room
Models
Voices
30 prebuilt voices:
Director's Notes (--director-notes)
Performance guidance for the selected voice. Define only what matters — overspecifying limits the model's creativity and can worsen results.
The three most common directions are Style, Pacing, and Accent, but you can include any custom instructions relevant to the performance.
- Style — Emotional quality and delivery character. Be descriptive:
"Infectious enthusiasm — the listener should feel part of something exciting"works better than just"energetic". You can layer characteristics and use voiceover industry terms like "vocal smile". - Pacing — Overall speed and rhythm variation. Can range from
"Speak as fast as possible"to"Incredibly slow and liquid, words bleed into each other, zero urgency". - Accent — Be specific.
"British English as heard in Croydon, England"works much better than"British accent".
Audio Tags
Inline [brackets] in segment text for per-word control. Override director-notes locally.
[whispers] [shouting] [excited] [serious] [short pause] [laughs] [very fast] [very slow] [sarcastic] [curious]
Creative tags work too: [like dracula], [whispering conspiratorially]
Example: "[excited] This changes everything! [short pause] Let me show you how."
References
- Prompting Guide [blocked] — Advanced prompt engineering for style, emotion, and accent