360 Secure SkillHub
360 安全技能中心

Voice To Text

该 Skill 运行本地 transcribe.py 脚本,调用 Vosk 离线语音识别把语音消息或音频文件转成文本。需自行安装 ffmpeg 与 vosk 包并下载模型;支持 MP3、WAV、M4A、OGG、FLAC、AAC、WEBM 等格式,音频先转为 16kHz 单声道 WAV,可通过环境变量指定模型,识别过程离线。

vae999
vae999
热度 39.76
最近更新 2026-05-11 17:26:03
分类:效率依赖:代码执行 / 读写文件应用场景:文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add voice-to-text
Metadata
name
voice-to-text
version
1.0.0
description
Convert voice messages and audio files to text using Vosk offline speech recognition. Use when a user sends a voice message, audio file, or asks to transcribe speech to text.
homepage
https://alphacephei.com/vosk/
metadata
{"openclaw":{"emoji":"🎤","os":["darwin","linux"],"requires":{"bins":["ffmpeg"],"python":["vosk"]},"install":[{"id":"brew-ffmpeg","kind":"brew","formula":"ffmpeg","bins":["ffmpeg"],"label":"Install ffmpeg via Homebrew"},{"id":"pip-vosk","kind":"pip","package":"vosk","label":"Install Vosk via pip"}]}}

Voice to Text

Convert voice messages and audio files to text using Vosk, an offline speech recognition toolkit.

Setup

  1. Install dependencies:

    # macOS
    brew install ffmpeg
    pip install vosk
    
    # Linux
    apt-get install ffmpeg
    pip install vosk
    
  2. Download a Vosk model:

    mkdir -p ~/.vosk/models && cd ~/.vosk/models
    
    # Chinese (small, fast)
    curl -LO https://alphacephei.com/vosk/models/vosk-model-small-cn-0.22.zip
    unzip vosk-model-small-cn-0.22.zip
    
    # English (small)
    curl -LO https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
    unzip vosk-model-small-en-us-0.15.zip
    

Usage

When the user provides a voice message or audio file path, run the transcription:

python3 ~/skills/voice-to-text/transcribe.py "<audio_file_path>"

For specific model selection, set the environment variable:

VOSK_MODEL_PATH=~/.vosk/models/vosk-model-cn-0.22 python3 ~/skills/voice-to-text/transcribe.py "<audio_file_path>"

Supported Audio Formats

  • MP3, WAV, M4A, OGG, FLAC, AAC, WEBM
  • Voice messages from WeChat, Telegram, WhatsApp, etc.

Available Models

Model Language Size Notes
vosk-model-small-cn-0.22 Chinese 42M Fast, good accuracy
vosk-model-cn-0.22 Chinese 1.3G High accuracy
vosk-model-small-en-us-0.15 English 40M Fast, good accuracy
vosk-model-en-us-0.22 English 1.8G High accuracy

Download models from: https://alphacephei.com/vosk/models

Example Workflow

  1. User sends a voice message via WeChat/Telegram
  2. OpenClaw receives the audio file
  3. Run: python3 transcribe.py /path/to/voice.ogg
  4. Return transcribed text to user

Troubleshooting

  • No model found: Download a model to ~/.vosk/models/
  • ffmpeg not found: Install via brew install ffmpeg or apt install ffmpeg
  • Poor accuracy: Try a larger model for better results

Notes

  • Works completely offline after model download
  • Supports multiple languages (download appropriate model)
  • Audio is converted to 16kHz mono WAV for processing