Google Cloud Text-to-Speech
Converts text and documents into audio using Google Cloud TTS API. Supports Neural2, WaveNet, Studio, and Standard voices across 40+ languages.
Setup
API key via GOOGLE_TTS_API_KEY env var or skills/google-tts/config.json with {"api_key": "..."}.
Requires ffmpeg for multi-chunk documents. Optional: pip install PyPDF2 python-docx for PDF/DOCX.
Commands
List Voices
python skills/google-tts/scripts/google_tts.py voices --language en-US --type Neural2
python skills/google-tts/scripts/google_tts.py voices --json
Text-to-Speech
# From text or document (PDF, DOCX, MD, TXT)
python skills/google-tts/scripts/google_tts.py tts --text "Hello world" --output ~/Downloads/hello.mp3
python skills/google-tts/scripts/google_tts.py tts --file /path/to/doc.pdf --output ~/Downloads/narration.mp3
# With voice, rate, pitch, encoding options
python skills/google-tts/scripts/google_tts.py tts --file doc.md --voice en-US-Neural2-F --rate 0.9 --encoding MP3 --output ~/Downloads/out.mp3
Podcast Generation
Takes a JSON script with alternating speakers, synthesizes each with a different voice.
[
{"speaker": "host1", "text": "Welcome to our podcast!"},
{"speaker": "host2", "text": "Thanks for having me..."}
]
python skills/google-tts/scripts/google_tts.py podcast --script /tmp/script.json --output ~/Downloads/podcast.mp3
python skills/google-tts/scripts/google_tts.py podcast --script /tmp/script.json --voice1 en-US-Neural2-J --voice2 en-US-Neural2-H --rate 0.9 --output ~/Downloads/podcast.mp3
Workflow
Single-Voice Narration
- If user provides a file path, use
--file. For generated content, write clean prose to /tmp/tts_input.md first.
- Default voice:
en-US-Neural2-D (male) or en-US-Neural2-F (female). Use Neural2 for best quality/cost balance.
- Generate:
python skills/google-tts/scripts/google_tts.py tts --file /tmp/tts_input.md --output ~/Downloads/recording.mp3
- Report file location and size. Default output to
~/Downloads/.
Podcast from Document
- Extract text:
python skills/google-tts/scripts/extract.py /path/to/document.pdf
- Generate a two-host conversation script as JSON:
- Natural discussion, not verbatim reading. Host 1 leads, Host 2 reacts/analyzes.
- Include intro and outro. Vary turn lengths. Keep turns under 4000 chars.
- Write script to
/tmp/podcast_script.json
- Generate:
python skills/google-tts/scripts/google_tts.py podcast --script /tmp/podcast_script.json --output ~/Downloads/podcast.mp3
- Clean up temp files.
Reference
- Recommended voice type: Neural2 (~$4/1M chars, high quality)
- Speaking rate: 0.25-4.0 (0.85-0.95 good for technical content)
- Pitch: -20.0 to 20.0 semitones
- Encodings: MP3 (default), LINEAR16 (.wav), OGG_OPUS (.ogg)
- API limit: 5000 bytes/request. Script auto-chunks at sentence boundaries.
1---2name: google-tts3description: Convert documents and text to audio using Google Cloud Text-to-Speech. Use when the user wants to narrate a document, read aloud text, generate audio from a file, convert text to speech, or create a podcast from a document. Trigger phrases - "read this aloud", "narrate this", "create a recording", "text to speech", "TTS", "convert to audio", "audio from document", "google tts", "create a podcast".4version: 1.0.05license: Apache-2.06tags: [media, tts, audio, text-to-speech, podcast, google-cloud, narration]7source: https://github.com/sanjay3290/ai-skills/tree/main/skills/google-tts8derived_from: awesomeclaude9metadata:10 source: https://skillmd.com/skills/aashutosh396/google-tts11---1213# Google Cloud Text-to-Speech1415Converts text and documents into audio using Google Cloud TTS API. Supports Neural2, WaveNet, Studio, and Standard voices across 40+ languages.1617## Setup1819API key via `GOOGLE_TTS_API_KEY` env var or `skills/google-tts/config.json` with `{"api_key": "..."}`.20Requires `ffmpeg` for multi-chunk documents. Optional: `pip install PyPDF2 python-docx` for PDF/DOCX.2122## Commands2324### List Voices2526```bash27python skills/google-tts/scripts/google_tts.py voices --language en-US --type Neural228python skills/google-tts/scripts/google_tts.py voices --json29```3031### Text-to-Speech3233```bash34# From text or document (PDF, DOCX, MD, TXT)35python skills/google-tts/scripts/google_tts.py tts --text "Hello world" --output ~/Downloads/hello.mp336python skills/google-tts/scripts/google_tts.py tts --file /path/to/doc.pdf --output ~/Downloads/narration.mp33738# With voice, rate, pitch, encoding options39python skills/google-tts/scripts/google_tts.py tts --file doc.md --voice en-US-Neural2-F --rate 0.9 --encoding MP3 --output ~/Downloads/out.mp340```4142### Podcast Generation4344Takes a JSON script with alternating speakers, synthesizes each with a different voice.4546```json47[48 {"speaker": "host1", "text": "Welcome to our podcast!"},49 {"speaker": "host2", "text": "Thanks for having me..."}50]51```5253```bash54python skills/google-tts/scripts/google_tts.py podcast --script /tmp/script.json --output ~/Downloads/podcast.mp355python skills/google-tts/scripts/google_tts.py podcast --script /tmp/script.json --voice1 en-US-Neural2-J --voice2 en-US-Neural2-H --rate 0.9 --output ~/Downloads/podcast.mp356```5758## Workflow5960### Single-Voice Narration61621. If user provides a file path, use `--file`. For generated content, write clean prose to `/tmp/tts_input.md` first.632. Default voice: `en-US-Neural2-D` (male) or `en-US-Neural2-F` (female). Use Neural2 for best quality/cost balance.643. Generate: `python skills/google-tts/scripts/google_tts.py tts --file /tmp/tts_input.md --output ~/Downloads/recording.mp3`654. Report file location and size. Default output to `~/Downloads/`.6667### Podcast from Document68691. Extract text: `python skills/google-tts/scripts/extract.py /path/to/document.pdf`702. Generate a two-host conversation script as JSON:71 - Natural discussion, not verbatim reading. Host 1 leads, Host 2 reacts/analyzes.72 - Include intro and outro. Vary turn lengths. Keep turns under 4000 chars.733. Write script to `/tmp/podcast_script.json`744. Generate: `python skills/google-tts/scripts/google_tts.py podcast --script /tmp/podcast_script.json --output ~/Downloads/podcast.mp3`755. Clean up temp files.7677## Reference7879- **Recommended voice type**: Neural2 (~$4/1M chars, high quality)80- **Speaking rate**: 0.25-4.0 (0.85-0.95 good for technical content)81- **Pitch**: -20.0 to 20.0 semitones82- **Encodings**: MP3 (default), LINEAR16 (.wav), OGG_OPUS (.ogg)83- API limit: 5000 bytes/request. Script auto-chunks at sentence boundaries.