图像与设计
需要文本转语音旁白、配音、无障碍朗读或批量语音生成时,用…
用户要求文本转语音、旁白、产品演示配音、IVR 提示音、无障碍朗读或批量语音生成时,用捆绑的 `scripts/text_to_speech.py` 调用 OpenAI Audio API 生成口语音频。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
需要文本转语音旁白、配音、无障碍朗读或批特定
解决思路
- 判断单条还是批量:如果用户提供多行/多个 prompts 或想要多个输出,走批量;否则走单条。
- 提前收集输入:逐字原文、期望 voice、delivery style、格式以及任何约束。
- 批量时在 `tmp/` 下写临时 JSONL(每行一个 job),运行一次,然后删除该 JSONL。
- 将 instructions 增强为简短、带标签的 spec,但不重写输入文本。
- 运行捆绑 CLI `scripts/text_to_speech.py`,使用合理默认值(见 `references/cli.md`)。
- 对重要 clips 做验证:可懂度、节奏、发音、是否遵守约束。
- 迭代时只做一项针对性变更(voice、speed 或 instructions),然后重新检查。
- 保存/返回最终输出,并记录最终文本、instructions 和 flags。
- 中间文件用 `tmp/speech/`(例如 JSONL 批量);完成后删除。
- 在此 repo 中工作时,将最终 artifacts 写到 `output/speech/`。
- 用 `--out` 或 `--out-dir` 控制输出路径;保持文件名稳定且具描述性。
- 依赖缺失时优先用 `uv` 管理依赖。
- 安装 Python 包:`uv pip install openai`。
- 如果 `uv` 不可用:`python3 -m pip install openai`。
- 实时 API 调用前必须设置 `OPENAI_API_KEY`。
- 如果 key 缺失,给用户步骤:在 OpenAI platform UI 创建 API key:https://platform.openai.com/api-keys。
- 让用户在其系统中将 `OPENAI_API_KEY` 设为环境变量。
- 如需要,提供指导帮用户按其 OS/shell 设置环境变量。
- 绝不要让用户在聊天中粘贴完整 key;让用户本地设置并确认就绪。
- 如果当前环境无法安装,告诉用户缺少哪个依赖以及如何在本地安装。
- 除非用户要求其他模型,使用 `gpt-4o-mini-tts-2025-12-15`。
- 默认 voice 用 `cedar`;如果用户想要更明亮音色,优先 `marin`。
- 只用内置 voices;自定义 voices 超出本技能范围。
- `instructions` 支持 GPT-4o mini TTS 模型,但不支持 `tts-1` 或 `tts-1-hd`。
- 每个请求输入长度必须 <= 4096 字符;更长文本拆成 chunks。
- 强制 50 requests/minute;CLI 将 `--rpm` 上限设为 50。
- 任何实时 API 调用前要求 `OPENAI_API_KEY`。
- 向最终用户提供清晰披露:该 voice 是 AI-generated。
- 所有 API 调用使用 OpenAI Python SDK(`openai` 包);不要用 raw HTTP。
- 优先使用捆绑 CLI `scripts/text_to_speech.py`,不要写新的 one-off scripts。
- 绝不修改 `scripts/text_to_speech.py`;如果缺少什么,先询问用户再做其他事。
- 将用户方向重排为简短、带标签的 spec;只让隐含细节显式化,不要发明新要求。
- 如果用户说 `narration for a demo`,可添加隐含的 delivery 约束(清晰、稳定节奏、友好语气)。
- 不要引入用户未要求的 new persona、accent 或 emotional style。
- 指令模板按需包含相关行:`Voice Affect:`、`Tone:`、`Pacing:`、`Emotion:`、`Pronunciation:`、`Pauses:`、`Emphasis:`、`Delivery:`。
- 增强规则:保持简短;只添加用户已经暗示或提供的细节。
- 增强规则:不要重写输入文本。
- 增强规则:如果关键细节缺失且阻碍成功,提问;否则继续。
- 单条示例:输入文本 `Welcome to the demo. Today we'll show how it works.`,instructions 包含 `Voice Affect: Warm and composed.`、`Tone: Friendly and confident.`、`Pacing: Steady and moderate.`、`Emphasis: Stress demo and show.`。
- 批量示例:JSONL 每行包含 `input`、`voice`、`response_format`,可选 `out` 和 `instructions`,例如 IVR prompts 用 `cedar`/`marin` 输出 `hold.mp3` 或 wav。
- 指令最佳实践:按 affect -> tone -> pacing -> emotion -> pronunciation/pauses -> emphasis 的结构写方向。
- 保持 4 到 8 个短行;避免冲突指导。
- 对 names/acronyms 添加 pronunciation hints(例如 `enunciate A-I`),或在文本中提供 phonetic spelling。
- 对 edits/iterations,重复 invariants(例如 `keep pacing steady`)以减少 drift。
- 用 single-change follow-ups 迭代。
- 更多原则见 `references/prompting.md`;复制/粘贴 specs 见 `references/sample-prompts.md`。
- 按用例使用模块:Narration / explainer 见 `references/narration.md`。
- Product demo / voiceover 见 `references/voiceover.md`。
- IVR / phone prompts 见 `references/ivr.md`。
- Accessibility reads 见 `references/accessibility.md`。
- CLI 命令 + 示例见 `references/cli.md`。
- API 参数速查见 `references/audio-api.md`。
- Instruction patterns + 示例见 `references/voice-directions.md`。
- 如果 network approvals / sandbox settings 有阻碍,见 `references/codex-network.md`。
- `references/cli.md`:如何通过 `scripts/text_to_speech.py` 运行 speech generation/batches(commands、flags、recipes)。
- `references/audio-api.md`:API parameters、limits、voice list。
- `references/voice-directions.md`:instruction patterns 和 examples。
- `references/prompting.md`:instruction best practices(structure、constraints、iteration patterns)。
- `references/sample-prompts.md`:copy/paste instruction recipes(仅 examples;无额外 theory)。
- `references/narration.md`:narration 和 explainers 的 templates + defaults。
- `references/voiceover.md`:product demo voiceovers 的 templates + defaults。
- `references/ivr.md`:IVR/phone prompts 的 templates + defaults。
- `references/accessibility.md`:accessibility reads 的 templates + defaults。
- `references/codex-network.md`:environment/sandbox/network-approval troubleshooting。
适用边界 · 注意事项
- 需要自定义声音创建时,超出本技能范围。
- 无法设置 `OPENAI_API_KEY`、无法安装 `openai` 或无法访问 OpenAI Audio API 时。
- 用户要求使用非 OpenAI TTS 提供商或不允许云 API 时。