技能标识:sensevoice-transcribe
Transcribe audio files (WAV/MP3/M4A/FLAC) to timestamped text using SenseVoice-Small + FSMN-VAD. Supports single-file and batch mode with VAD-anchored per-segment timestamps (~15s granularity). Use when the user wants to transcribe speech/audio, run batch transcription on daylog recordings, or re-transcribe specific dates. Replaces the old whisper-transcribe skill.
使用 FunASR 的 iic/SenseVoiceSmall 模型,结合 fsmn-vad 进行时间戳锚定,将音频转录为带时间戳的文本。
虚拟环境:~/.openclaw/venvs/sensevoice/
Python:3.12
关键包:funasr==1.3.1, modelscope, onnxruntime
模型缓存:~/.cache/modelscope/hub/models/iic/SenseVoiceSmall
VAD缓存:~/.cache/modelscope/hub/models/iic/speechfsmnvad_zh-cn-16k-common-pytorch
bash
python3 -m venv ~/.openclaw/venvs/sensevoice
source ~/.openclaw/venvs/sensevoice/bin/activate
pip install funasr modelscope onnxruntime
bash
source ~/.openclaw/venvs/sensevoice/bin/activate
python3 -c
from funasr import AutoModel
from funasr.utils.postprocessutils import richtranscription_postprocess
from datetime import datetime, timedelta
import re
wav =
从文件名解析开始时间:TX01MIC01520260308124130orig.wav
m = re.search(r(\d{8})_(\d{6}), wav)
start_dt = datetime.strptime(m.group(1)+m.group(2), %Y%m%d%H%M%S) if m else None
vadmodel = AutoModel(model=fsmn-vad, disableupdate=True)
model = AutoModel(model=iic/SenseVoiceSmall, vad_model=fsmn-vad,
vadkwargs={maxsinglesegmenttime: 30000}, device=cpu)
vadsegs = vadmodel.generate(input=wav)[0].get(value, [])
res = model.generate(input=wav, cache={}, language=zh, use_itn=True,
batchsizes=60, merge_vad=True)
texts = [richtranscriptionpostprocess(s).strip()
for s in re.split(r<\|zh\|>, res[0][text]) if s.strip()]
texts = [s for s in texts if len(s) > 1]
ratio = len(vad_segs) / len(texts) if texts else 1
for i, t in enumerate(texts):
vi = min(int(i * ratio), len(vad_segs)-1)
ts = (startdt + timedelta(milliseconds=vadsegs[vi][0])).strftime(%H:%M:%S) if startdt else f{vadsegs[vi][0]//1000:.0f}s
print(f[{ts}] {t})
配套的 scripts/batch_transcribe.py 脚本处理完整的日志流程:
bash
source ~/.openclaw/venvs/sensevoice/bin/activate
cd ~/Documents/dec/daylog
参数说明:
| 参数 | 说明 |
|---|---|
| --dry-run | 预览模式,不写入文件 |
| --engine sensevoice\ |
目录结构:
daylog/
├── raw/ # WAV 输入(DJI MIC 3,48kHz/32bit,~247MB/30分钟)
│ ├── TX01MIC00920260308094129orig.wav
│ └── ...
├── transcripts/ # 输出,按日期分组
│ └── 2026-03-08/
│ ├── 000TX01MIC00920260308094129_orig.txt
│ └── ...
└── notes/ # 编译的每日笔记(单独步骤)
└── 2026-03-08.md
行为说明:
[录音开始: 09:41:29]
[09:41:35] 到了,我们下车吧。
[09:41:48] 武康大楼,人好多啊。
[09:42:04] 你帮我在这里拍一张。
...
| 指标 | 数值 |
|---|---|
| RTF | ~0.04(25倍实时) |
| CPU |
| Whisper(旧版) | SenseVoice(新版) | |
|---|---|---|
| 模型 | mlx-whisper-medium | SenseVoice-Small(234MB) |
| 准确率 |
SenseVoice 会为片段附加情感标签(😊😔😡😮)。这些是模型产物,反映检测到的语音情感,并非音频中的实际表情符号。下游处理(笔记编译)应忽略或去除这些标签。
以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:
帮我安装 SkillHub 和 sensevoice-transcribe-1776118420 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 sensevoice-transcribe-1776118420 技能
skillhub install sensevoice-transcribe-1776118420
文件大小: 9.16 KB | 发布时间: 2026-4-15 14:19