agentleFS
yangwhaleyangwhale/CloseCrab/skills/tts-generator/SKILL.md

tts-generator

Skill5 starsChanged 3 months agoApache-2.0View on GitHub

Generate speech audio from text using Gemini 3.1 Flash TTS (with emotion control) or Edge TTS fallback. Use when the user says "/tts", "语音合成", "文字转语音", "念出来", "读出来", "生成语音", "帮我念", "说出来", or when asked to convert text to speech audio.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If Gemini fails, automatically falls back to Edge TTS

    line 114

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TTS Generator (Gemini 3.1 Flash TTS)

Generate expressive speech audio using Google Gemini 3.1 Flash TTS with emotion/audio tag support. Falls back to Edge TTS if Gemini is unavailable.

Usage

# Generate OGG audio (Gemini, default)
OGG=$(~/.claude/skills/tts-generator/scripts/tts-generate.py "[casually] 你好世界")

# Choose voice
OGG=$(~/.claude/skills/tts-generator/scripts/tts-generate.py "[excitedly] 太棒了!" --voice sulafat)

# Fallback to Edge TTS
OGG=$(~/.claude/skills/tts-generator/scripts/tts-generate.py "你好" --engine edge --voice xiaoxiao)

# Send as Discord voice message
~/.claude/scripts/send-to-discord.sh --voice "$OGG"

# Clean up
rm -f "$OGG"

Gemini Voices (15 voices)

代号风格代号风格
aoede (default)轻松achird友好
sulafat温暖kore坚定
puck欢快charon知性
fenrir兴奋leda青春
zephyr明亮achernar柔和
gacrux成熟sadachbia活泼
algieba顺滑vindemiatrix温柔
orus坚定

Emotion Tags (Gemini only)

Gemini TTS 支持 inline audio tags 控制情感和风格。有两种工作模式,行为不同:

模式 A:单标签(director instruction)

只有一个开头标签时,脚本把它翻译成 director 指令喂给 Gemini:"[casually] 你好" → "Say the following in Chinese, casually:\n你好"。这种模式下任意词都能用(因为 Gemini 把它当自然语言指令理解),所以下面这些"自创"标签都能工作:

"[casually] 今天的进度还不错"        # 随意
"[excitedly] 实验通过了!"           # 兴奋
"[thoughtfully] 这个方案有两个权衡点" # 思考
"[seriously] 注意这个安全隐患"        # 严肃
"[cheerfully] 早上好!"              # 愉快
"[calmly] 总结一下今天的工作"         # 平静

模式 B:多个 inline 标签(raw passthrough)

文本里有 ≥2 个标签时,脚本不动它,原样 pass 给 Gemini。Gemini 只认它训练时见过的官方词,自创词会被静默丢弃。一段话里想多次切换情绪(推荐用法,更生动)必须用下面的官方词:

思考类:[thinking] [contemplative] [analysis] [focus] [reflection] [planning] [speculation] [pensive] [curiosity]

积极类:[excitement] [enthusiasm] [joy] [happy] [pleased] [optimism] [playful] [amusement] [friendly] [triumph] [satisfaction]

中性类:[neutral] [contentment] [serenity] [relaxation] [certainty]

严肃类:[seriousness] [urgency] [warning] [concern] [caution] [emphasis]

惊讶类:[surprise] [amazement] [realization] [confusion] [uncertainty] [doubt] [disbelief]

消极类:[disappointment] [frustration] [regret] [exhaustion] [weariness]

幽默类:[humor] [sarcasm] [amused] [self-deprecation]

自信类:[confidence] [determination] [assertive] [pride]

特效类:[laughs] [sighs] [slow] [fast]

⛔ 不要用 [whispers]。 它是 Gemini 官方标签、模型会照做,而照做的结果是 音量小到在手机外放、车里、地铁上根本听不见(Chris 2026-09-17 明确要求去掉)。 CloseCrab 的 TTS 链路里 normalize_tts_tags() 会把它换成 [casually], 所以写了也不生效 —— 但走本 skill 直接调 API 的场合没有那层兜底,别写。

说明类:[informative] [explaining] [summary] [instruction] [suggestion]

多标签例子(好):

[curiosity] 我先看下日志。[realization] 哦原来是端口冲突。
[amused] 这种小坑最烦了。[suggestion] 你 kill 8080 那个就行。

多标签例子(差):

[casually] 我看了日志发现端口冲突 你 kill 8080 就行
# 整段一个标签,且 [casually] 不是官方词,多标签场景下还会被丢

Edge TTS Voices (fallback)

  • xiaoxiao — 女声(默认)
  • xiaoyi — 女声,温柔
  • yunxi — 男声,活力
  • yunjian — 男声,成熟
  • yunyang — 男声,新闻播报
  • yunxia — 男声,少年

Notes

  • Output: OGG Opus (1ch, 48kHz, 48kbps)
  • Gemini TTS needs GOOGLE_API_KEY env var or GCP Application Default Credentials
  • Gemini supports 80+ languages with auto-detection
  • If Gemini fails, automatically falls back to Edge TTS

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.