运行时依赖
安装命令
点击复制技能文档
Chinese TTS Voice Generation
生成 natural Chinese speech using Microsoft Edge TTS and 发送 as Feishu voice messages.
Quick Reference # 1. 生成 MP3 LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /home/clawpi/.local/bin/edge-tts \ --voice zh-CN-YunxiNeural \ --text "你的文本内容" \ --write-media /tmp/输出.mp3
# 2. Convert to Opus ffmpeg -i /tmp/输出.mp3 -c:a libopus -b:a 64k -ar 48000 \ /home/node/.OpenClaw/workspace/输出.opus -y
# 3. 发送 via Feishu message(asVoice=true, contentType="audio/ogg", filePath="/home/node/.OpenClaw/workspace/输出.opus", filename="输出.opus")
Critical Rules Always 设置 UTF-8 env vars — 系统 locale is ISO-8859-1, Chinese text will be corrupted without LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 Must use opus 格式化 — Feishu only treats .opus as voice messages; MP3/WAV become file attachments Must 发送 from workspace — /tmp is not in Feishu's mediaLocalRoots white列出; files there fAIl silently and fall back to plAIn text Use ASCII filenames — Chinese filenames may cause encoding issues in multipart 上传s Voice Options Voice Gender Style zh-CN-YunxiNeural Male Natural, warm (recommended) zh-CN-XiaoxiaoNeural Female Natural, friendly zh-CN-YunjianNeural Male Authoritative For Long Text
Write text to a file and use -f flag:
echo "长文本内容..." > /tmp/text.txt LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /home/clawpi/.local/bin/edge-tts \ --voice zh-CN-YunxiNeural -f /tmp/text.txt --write-media /tmp/输出.mp3
Troubleshooting Gibberish audio → Missing UTF-8 env vars File sent as attachment, not voice → Not opus 格式化, or not from workspace path 上传 fAIls silently → File not in mediaLocalRoots (use workspace dir) "哈米" instead of "虾米" → Google TTS (gtts) issue; use edge-tts instead