Agent Skillssanjay3290/ai-skills › google-tts

google-tts

GitHub

利用 Google Cloud TTS API 将文本或文档转换为音频,支持单语朗读和多角色播客生成。

skills/google-tts/SKILL.md sanjay3290/ai-skills

Trigger Scenarios

用户希望朗读文本或文档 需要将内容转换为语音文件 请求生成播客或音频录制

Install

npx skills add sanjay3290/ai-skills --skill google-tts -g -y
More Options

Use without installing

npx skills use sanjay3290/ai-skills@google-tts

指定 Agent (Claude Code)

npx skills add sanjay3290/ai-skills --skill google-tts -a claude-code -g -y

安装 repo 全部 skill

npx skills add sanjay3290/ai-skills --all -g -y

预览 repo 内 skill

npx skills add sanjay3290/ai-skills --list

SKILL.md

Frontmatter
{
    "name": "google-tts",
    "description": "Convert documents and text to audio using Google Cloud Text-to-Speech.\nUse this skill when the user wants to: narrate a document, read aloud text,\ngenerate audio from a file, convert text to speech, create a recording\nof documentation or analysis, create a podcast from a document, or use\nGoogle TTS\/text-to-speech. Trigger phrases: \"read this aloud\", \"narrate this\",\n\"create a recording\", \"text to speech\", \"TTS\", \"convert to audio\",\n\"audio from document\", \"listen to this\", \"generate audio\", \"google tts\",\n\"create a podcast\"."
}

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

  1. If user provides a file path, use --file. For generated content, write clean prose to /tmp/tts_input.md first.
  2. Default voice: en-US-Neural2-D (male) or en-US-Neural2-F (female). Use Neural2 for best quality/cost balance.
  3. Generate: python skills/google-tts/scripts/google_tts.py tts --file /tmp/tts_input.md --output ~/Downloads/recording.mp3
  4. Report file location and size. Default output to ~/Downloads/.

Podcast from Document

  1. Extract text: python skills/google-tts/scripts/extract.py /path/to/document.pdf
  2. 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.
  3. Write script to /tmp/podcast_script.json
  4. Generate: python skills/google-tts/scripts/google_tts.py podcast --script /tmp/podcast_script.json --output ~/Downloads/podcast.mp3
  5. 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.

Version History

  • 3619692 Current 2026-07-24 17:34

Same Skill Collection

skills/atlassian/SKILL.md
skills/azure-devops/SKILL.md
skills/elevenlabs/SKILL.md
skills/gmail/SKILL.md
skills/google-calendar/SKILL.md
skills/google-chat/SKILL.md
skills/google-docs/SKILL.md
skills/google-drive/SKILL.md
skills/google-sheets/SKILL.md
skills/google-slides/SKILL.md
skills/grok-build/SKILL.md
skills/imagen/SKILL.md
skills/jules/SKILL.md
skills/manus/SKILL.md
skills/mssql/SKILL.md
skills/mysql/SKILL.md
skills/notebooklm/SKILL.md
skills/postgres/SKILL.md
skills/apple-container/SKILL.md
skills/telegram/SKILL.md
skills/whatsapp/SKILL.md

Metadata

Files
0
Version
3619692
Hash
1254defe
Indexed
2026-07-24 17:34

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-22 01:14
浙ICP备14020137号-1 $방문자$