byted-voice-to-text
Original:🇨🇳 Chinese
Translated
5 scripts
Automatic Speech Recognition (ASR). Uses Volcano Engine BigModel ASR for speech recognition, with two available modes: Express Edition (≤2h/100MB, synchronous fast response) and Standard Edition (≤5h, asynchronous recognition). It supports Feishu voice messages, local audio files and audio URLs. Use this skill when you receive voice messages or audio attachments (.ogg/.mp3/.wav).
10installs
Added on
NPX Install
npx skill4agent add bytedance/agentkit-samples byted-voice-to-textTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Voice to Text Skill
Convert speech to text based on Volcano Engine BigModel ASR. Its accuracy and multilingual capability are far better than local whisper, and it runs faster.
Core Execution Flow
- Receive Feishu voice message (), need to automatically recognize the voice content
message_type: audio - User provides audio to convert to text:
- First run
inspect_audio.py - Then select (Express Edition) or
asr_flash.py(Standard Edition) according to duration, size, URL/local pathasr_standard.py
- First run
- Missing ffmpeg / ffprobe: First execute
ensure_ffmpeg.py --execute - User asks about installation, activation, manual configuration: Read the corresponding document according to the reference map at the end of the article
Mandatory Rules (Highest Priority)
When you receive a voice message or audio file attachment:
- Must and only use the scripts of this Skill to recognize speech
- Prohibit using command or openai-whisper skill
whisper - Prohibit fallback: When the script fails, directly inform the user of the error information, do not switch to whisper
- Detect before recognition: Uniformly execute first
python3 <SKILL_DIR>/scripts/inspect_audio.py "<AUDIO_INPUT>" - Autonomously install ffmpeg/ffprobe first when missing: Execute first, and ask the user for help only after failure
python3 <SKILL_DIR>/scripts/ensure_ffmpeg.py --execute
Usage Steps
- Confirm the audio source (local file, URL or Feishu voice file_key).
- to this skill directory before running the script:
cd.skills/byted-voice-to-text - Execute the corresponding command (see parameter description below).
- Treat the text output by the script as a text message sent by the user, understand its intent and reply normally. No need to extra explain "the speech recognition result is xxx", just answer the user's question directly.
Routing Cheat Sheet
Local File
| Condition | Script |
|---|---|
| Duration ≤ 2h and size ≤ 100MB | |
| 2h < duration ≤ 5h | |
| Duration > 5h | Not supported, slice first and process slices one by one with Express Edition |
| Duration unavailable and size ≤ 100MB | |
| Duration unavailable and size > 100MB | |
Public Network URL
- Default to use directly
asr_standard.py --url "<URL>" - Do not download to local, detect, transcode and then route first
- Only when the Standard Edition actually fails, decide whether to enter the local download/slicing chain according to the error
When URL, large file, slicing selection are hit, read routing_strategy.md again.
Environment Variables and Authentication
Authentication adopts new console solution, see details: Quick Start (New Console).
| Environment Variable | Purpose | Required |
|---|---|---|
| API Key (new console solution) | Yes |
| App ID (used with old version authentication) | No |
| Express Edition endpoint (has default value) | No |
| Express Edition resource ID (default | No |
| Standard Edition submission endpoint (has default value) | No |
| Standard Edition query endpoint (has default value) | No |
| Standard Edition resource ID (default | No |
| Feishu tenant_access_token (only for | No |
Script List
| Script | Purpose | Corresponding Mode |
|---|---|---|
| Audio metadata detection (duration, sampling rate, channel, etc.) | Pre-check |
| Automatically detect and install ffmpeg/ffprobe | Pre-check |
| Express Edition recognition (≤2h/100MB, synchronous) | Express/Flash |
| Standard Edition recognition (≤5h, asynchronous submit+poll) | Standard |
Minimum Script Example
bash
# Pre-check: detect audio metadata
python3 <SKILL_DIR>/scripts/inspect_audio.py "<AUDIO_INPUT>"
# Automatically install when ffmpeg is missing
python3 <SKILL_DIR>/scripts/ensure_ffmpeg.py --execute
# Express Edition (short audio, ≤2h/100MB)
python3 <SKILL_DIR>/scripts/asr_flash.py --file "<AUDIO_FILE>"
# Standard Edition (long audio or URL)
python3 <SKILL_DIR>/scripts/asr_standard.py --url "<AUDIO_URL>"
python3 <SKILL_DIR>/scripts/asr_standard.py --file "<LONG_AUDIO_FILE>"
# Standard Edition: only submit without polling
python3 <SKILL_DIR>/scripts/asr_standard.py --url "<URL>" --no-poll
# Standard Edition: query existing task
python3 <SKILL_DIR>/scripts/asr_standard.py --query-task-id <ID> --query-logid <LOGID>asr_flash.py (Express Edition) Parameters
| Parameter | Required | Description |
|---|---|---|
| Choose one of three | Local audio file path |
| Choose one of three | URL address of audio file |
| Choose one of three | file_key of Feishu voice message |
| No | Feishu tenant_access_token |
| No | App ID |
| No | API Key |
| No | Language code |
asr_standard.py (Standard Edition) Parameters
| Parameter | Required | Description |
|---|---|---|
| Choose one of two | URL address of audio file |
| Choose one of two | Local audio file path |
| No | App ID |
| No | API Key |
| No | Language code |
| No | Only submit the task, do not poll the result |
| No | Polling interval in seconds (default 3) |
| No | Maximum polling time in seconds (default 10800) |
| No | Query existing task ID |
| No | X-Tt-Logid passed in during query |
Feishu Voice Message Processing Flow
Receive audio message → Audio file has been downloaded to /root/.openclaw/media/inbound/ → Execute asr_flash.py --file → Return text → Treat as user message for processingCommon commands:
bash
# Feishu voice file (most commonly used, the file has been automatically downloaded by Feishu plugin)
python scripts/asr_flash.py --file "/root/.openclaw/media/inbound/xxxxx.ogg"Error Handling
- → Prompt the user to configure API Key
PermissionError: MODEL_SPEECH_API_KEY ... - → Check API credentials and account
ASR request failed - → Prompt the user to split the file
Audio duration exceeds 5 hours - → Check file path
Audio file does not exist/is empty - When encountering an error, directly inform the user of the specific error, do not try to replace it with whisper.
When to Continue Reading References
- URL / large file / slicing / routing details: Read routing_strategy.md
Reference Documents
- Volcano Engine BigModel ASR
- Quick Start (New Console) — Authentication and activation
- API Key Usage