返回顶部
s

speech-translation语音翻译工作流

Build, adapt, or run an audio-processing workflow that takes spoken audio, transcribes it with Whisper or faster-whisper, translates the transcript using the current agent model by default, and synthesizes translated speech with Piper, the OpenClaw tts tool, or a mock backend. Use when the user wants 语音转写、翻译、译文语音合成, wants an existing voice translation prototype operationalized, or wants a chat-native flow where sending a voice message automatically yields transcript text, translation text, and t

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
138
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

speech-translation

语音翻译

使用此技能处理两种紧密相关的模式:

  1. 1. 聊天原生模式:用户在OpenClaw中发送音频或语音消息;返回转录文本、翻译文本和翻译后的音频。
  2. 本地流水线模式:运行基于文件的确定性流水线,生成转录、翻译、wav和元数据文件。

默认采用LLM辅助翻译工作流:让当前智能体生成翻译,使用本地流水线时保存到文件,或在聊天中直接响应时使用周围的智能体轮次。

工作流

A. 聊天原生模式

当入站消息已包含来自OpenClaw媒体理解的音频转录,或用户要求你以对话方式处理语音消息时使用此模式。

  1. 1. 检测到用户发送了音频或请求进行语音翻译。
  2. 获取或确认转录文本。
  3. 使用当前模型进行翻译。
  4. 将转录文本发送给用户。
  5. 将翻译文本发送给用户。
  6. 将翻译文本合成为音频:
- 当需要立即回复带有音频的聊天时,优先使用OpenClaw的tts工具 - 当需要本地wav文件时,优先使用Piper
  1. 7. 保持输出顺序稳定:先转录,再翻译,最后音频。

B. 本地流水线模式

  1. 1. 确认输入/输出预期:源语言、目标语言、输出目录,以及运行应为真实还是模拟。
  2. 选择后端:
- faster-whisper用于真实转录,mock用于流水线测试。 - 当有智能体/模型可用时,llm作为默认翻译路径。 - 仅在需要无人值守的HTTP翻译时使用service。 - manual仅作为回退方案。 - piper用于真实TTS,mock用于空运行测试。
  1. 3. 运行转录。
  2. 如果使用默认的llm路径,读取转录并使用当前模型进行翻译。将翻译文本保存到文件。
  3. 使用--translation-file运行合成/输出写入。
  4. 检查输出:
- 01_transcript.txt - 02_translation.txt - 03_translation.wav - result.json
  1. 7. 如果用户希望在处理过程中获得聊天更新,使用--transcript-command、--translation-command和--audio-command传递通知命令。

首选执行模式

默认LLM辅助路径

当处理任务的智能体可以自行翻译转录时使用此模式。

  1. 1. 转录可用后运行流水线,或在准备好translation.txt后运行完整命令。
  2. 将模型生成的翻译保存到文件。
  3. 调用:

bash
bash scripts/runvoicetranslate_llm.sh \
/path/to/input.m4a \
./outputs/llm-run \
zh \
en \
/path/to/en_US-lessac-medium.onnx \
./translation.txt \
--whisper-model small \
--transcribe-backend faster-whisper \
--tts-backend piper

当需要精确的编排模式或可复用的翻译提示时,请阅读references/llm-translation-pattern.md。

模拟端到端验证

当需要验证流水线结构而不依赖模型/运行时依赖时,首先使用此模式。

bash
python3 scripts/runvoicetranslate.py \
--input references/examples/mock-input.txt \
--output-dir ./outputs/mock-run \
--source-lang zh \
--target-lang en \
--transcribe-backend mock \
--translation-file ./translated.txt \
--translation-backend llm \
--no-interactive-translate \
--tts-backend mock \
--piper-model ./dummy.onnx

注意:

  • - mock转录从输入文件读取纯文本。
  • mockTTS写入静音wav文件。
  • 即使使用模拟TTS,当前CLI格式仍需要--piper-model;使用任何占位路径即可。
  • llm模式目前意味着翻译必须已存在于--translation-file中。

服务回退

bash
python3 scripts/runvoicetranslate.py \
--input /path/to/input.m4a \
--output-dir ./outputs/service-run \
--source-lang zh \
--target-lang en \
--whisper-model small \
--transcribe-backend faster-whisper \
--translation-backend service \
--translation-service-url http://127.0.0.1:8000/translate \
--tts-backend piper \
--piper-model /path/to/en_US-lessac-medium.onnx

资源

scripts/

  • - runvoicetranslate.py:主要入口点。
  • runvoicetranslatellm.sh:默认LLM辅助路径的轻量封装。
  • voicetranslateapp/:流水线模块。
  • sendtext.py:封装阶段文本并通过shell命令转发。
  • sendaudio.py:通过shell命令转发生成的音频。
  • mocktextsender.py、mockaudio_sender.py:本地冒烟测试辅助工具。

references/

  • - 阅读references/runtime-notes.md了解依赖/设置详情、后端行为和集成约束。
  • 当周围智能体应使用自身模型执行翻译时,阅读references/llm-translation-pattern.md。
  • 当实现或遵循对话流程时阅读references/openclaw-chat-mode.md:接收语音,输出转录文本,输出翻译文本,然后输出翻译后的音频。

编辑指南

  • - 保持SKILL.md流程化且简洁。
  • 将环境或后端特定的细节放在references中。
  • 将llm视为智能体驱动工作流的首选翻译路径。
  • 在聊天原生模式下,保持用户可见的顺序:转录文本、翻译文本、然后音频。
  • 对于即时对话音频回复,优先使用OpenClaw的tts;对于本地wav文件和离线流水线,优先使用Piper。
  • 如果用户希望更紧密的OpenClaw集成,添加附件感知的外部工作流或钩子,而不是重写ASR/TTS。
  • 除非用户要求更改,否则保持当前文件约定:转录、翻译、wav、元数据JSON。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 speech-translation-1775943576 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 speech-translation-1775943576 技能

通过命令行安装

skillhub install speech-translation-1775943576

下载

⬇ 下载 speech-translation v1.0.0(免费)

文件大小: 17.57 KB | 发布时间: 2026-4-12 11:30

v1.0.0 最新 2026-4-12 11:30
- Initial release of the voice translation skill.
- Supports audio transcription with Whisper or faster-whisper, translation by the current agent model, and speech synthesis using Piper, OpenClaw tts, or a mock backend.
- Offers two modes: chat-native voice translation and a deterministic local file-based pipeline.
- Ensures consistent output order: transcript, translation, then translated audio.
- Includes resources, references, and scripts for setup, orchestration, and backend selection.
- Designed for both interactive chat and automated batch workflows.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部