本文へ移動
cccskills
無料GitHub で公開

baidu-speech-to-text

百度语音识别 - 将语音消息转换为文本。支持中文普通话、英语、粤语、四川话。专为国内服务器环境优化,自动绕过代理访问百度 API。

インストール方法を見る

含まれるファイル(6)

  • SKILL.md3.8 KB
  • LICENSE.txt1.0 KB
  • README.md974 B
  • scripts/baidu_speech_to_text.py10.2 KB
  • scripts/ogg_to_text.sh1004 B
  • scripts/speech_to_text.sh613 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

百度语音识别 - 音频转文本

概述

本 skill 用于将用户发送的语音消息(ogg/opus 格式)转换为文本。使用百度语音识别 API,专为国内服务器 + 代理环境优化。

环境背景

问题场景

  • 国内服务器通过 proxychains4 代理访问海外服务(Discord、WhatsApp 等)
  • 但百度 API 是国内服务,通过代理访问反而会失败(SSL 错误)
  • 需要在代理环境下选择性绕过百度 API

解决方案

  • 使用 wrapper 脚本,通过 unset LD_PRELOAD 绕过 proxychains 注入
  • 脚本内部清除代理环境变量,确保直连百度 API

脚本文件

脚本路径用途
ogg_to_text.sh/root/.openclaw/workspace/scripts/ogg_to_text.sh推荐 - 简单易用
speech_to_text.sh/root/.openclaw/workspace/scripts/speech_to_text.sh完整功能版
baidu_speech_to_text.py/root/.openclaw/workspace/scripts/baidu_speech_to_text.pyPython 主脚本

使用方法

基本用法(中文普通话)

/root/.openclaw/workspace/scripts/ogg_to_text.sh <音频文件路径>

示例

# 转换用户语音消息
/root/.openclaw/workspace/scripts/ogg_to_text.sh /root/.openclaw/media/inbound/xxxxx.ogg

支持的语言

参数语言
--lang zh中文普通话(默认)
--lang en英语
--lang cantonese粤语
--lang sichuan四川话

使用极速版(更快,仅中文)

/root/.openclaw/workspace/scripts/speech_to_text.sh <音频文件> --pro

音频文件位置

用户通过 WhatsApp/Discord 发送的语音消息保存在:

/root/.openclaw/media/inbound/

文件格式通常为 .ogg(Opus 编码),脚本会自动转换为 PCM 格式。

工作流程

当用户发送语音消息并请求转文本时:

  1. 确定语音文件路径(/root/.openclaw/media/inbound/*.ogg)
  2. 执行转换:
    /root/.openclaw/workspace/scripts/ogg_to_text.sh /root/.openclaw/media/inbound/<文件名>.ogg
    
  3. 返回识别结果给用户

性能参考

阶段耗时说明
获取 token~100ms可缓存优化
ogg 转 pcm~150-220msffmpeg 转换
API 调用~400-600ms主要耗时
总计~700-1000ms

API 配置

使用环境变量提供百度 API 账号信息(请勿写入仓库):

export BAIDU_APP_ID="your_app_id"
export BAIDU_API_KEY="your_api_key"
export BAIDU_SECRET_KEY="your_secret_key"

端点:

错误处理

错误原因解决方案
SSL 错误代理影响确保使用 wrapper 脚本(.sh),不要直接调用 Python
识别结果为空静音或无语音告知用户音频可能没有语音内容
3301 错误音频质量差请用户重新录制
3303 错误语音过长需要分段处理

注意事项

  1. 必须使用 shell wrapper 脚本,不要直接调用 Python 脚本
  2. 脚本已内置代理绕过逻辑,在 proxychains 环境下可正常工作
  3. 短语音识别限制约 60 秒,超长音频需分段

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

日本語の概要は準備中です。原文の説明を表示しています。

castle-x/skills-x182026年4月16日 更新

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

日本語の概要は準備中です。原文の説明を表示しています。

castle-x/skills-x182026年4月16日 更新

Use when you have a written implementation plan to execute in a separate session with review checkpoints

日本語の概要は準備中です。原文の説明を表示しています。

castle-x/skills-x182026年4月16日 更新

帮助用户将飞书群机器人 Webhook 通知接入 Claude Code,使得每次任务完成后自动发送飞书消息卡片通知。 触发场景(当用户提到以下任意内容时激活此 skill): - "飞书通知"、"接入飞书"、"飞书提醒" - "task 完成通知"、"任务完成提醒" - "claude 完成提醒"、"claude 通知" - "Stop hook 通知"、"hook 通知" - "发飞书消息"、"飞书机器人" - "任务结束通知"、"配置通知"

日本語の概要は準備中です。原文の説明を表示しています。

castle-x/skills-x182026年4月16日 更新

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

日本語の概要は準備中です。原文の説明を表示しています。

castle-x/skills-x182026年4月16日 更新

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

日本語の概要は準備中です。原文の説明を表示しています。

castle-x/skills-x182026年4月16日 更新

castle-x のスキルをすべて見る

このスキルの問題を報告する