Install
openclaw skills install step-audiobookUse when your agent needs to build, maintain, or run the local `audiobook` skill for voice-library management, Step official voice sync, clone voice analysis, LLM casting, replayable TTS requests, segment synthesis, and final audiobook export.
openclaw skills install step-audiobook语言切换:当前为中文|English companion
audiobook 是一套完整的本地有声书工作流,覆盖 4 个阶段:
txt -> structured-scriptstructured-script -> casting-review -> casting-plancasting-plan -> tts-requests -> segments -> final audio它面向两类调用者:
artifacts.jsonaudiobook 不只是“把小说读出来”的 TTS 工具,而是一套围绕音色资产、结构化剧本、角色选角、可重放 TTS 请求和最终音频导出的完整本地工作流。
它的设计原则是:
step-audio-r1.1、官方音色接口、音色复刻接口、stepaudio-2.5-ttsstep-3.5step-3.5 调用走的是 Step 的 step_plan reasoning 接口,默认 endpoint 为 https://api.stepfun.com/step_plan/v1audiobook 当前覆盖以下能力:
step-audio-r1.1 对这些音频做声音特点分析,沉淀成后续角色选角可用的基础画像。step-3.5 做分块、章节感知、角色分析和结构化整理,生成一个包含旁白在内的 characters + structured-script 剧本结果;当前默认使用的就是 Step 的 step_plan 推理接口。step-3.5,但整体实现尽量不依赖写死的 NLP 规则,而是通过可替换的 LLM 配置层完成,便于后续切换到其他兼容 LLM。stepaudio-2.5-tts 调用习惯的可重放 TTS 请求清单,便于后续批量合成、局部重跑和参数调整。structured scriptunified voice candidate pooleffective profile,即 clone 音色真正参与选角的描述集合paid clone,即真正调用 Step 音色复刻接口的动作intermediate artifactshuman review 或 manual confirmationready voice,表示当前已经可以直接进入下游 TTS当前需要重点说明的是:并不是整个 skill 的所有能力都可以替换成别的模型。
step-3.5,且默认走 https://api.stepfun.com/step_plan/v1step-audio-r1.1 音频分析、Step 官方音色拉取、Step 音色复刻、stepaudio-2.5-tts 合成audiobook 当前是“Step 音频能力 + 可替换 LLM 推理层”的组合架构,而不是把所有能力都抽象成完全可替换的通用 provider下面这些路径是当前 skill 的默认约定:
WORKSPACE_ROOT=~/.openclaw/workspace
SKILL_ROOT=$WORKSPACE_ROOT/skills/audiobook
EXAMPLES_ROOT=$SKILL_ROOT/examples
VOICE_LIBRARY=$WORKSPACE_ROOT/audiobook-library/voice-library.yaml
LIBRARY_ROOT=$WORKSPACE_ROOT/audiobook-library
STORY_ROOT=$WORKSPACE_ROOT/audiobook-stories # 推荐放原始 txt / yaml / json
RUN_ROOT=$WORKSPACE_ROOT/runs/audiobook
下面所有命令示例默认都在 "$SKILL_ROOT" 目录里执行。也就是说,推荐先:
cd "$SKILL_ROOT"
如果你不想切换目录,请把文档里的 scripts/<name>.py 改成对应脚本的绝对路径。
关键位置:
$VOICE_LIBRARY$LIBRARY_ROOT/voices/inbox/$LIBRARY_ROOT/voices/references/<asset_id>/$LIBRARY_ROOT/.audiobook/$RUN_ROOT/<slug>/$EXAMPLES_ROOT/推荐但不强制:把原始小说文件统一放在 ~/.openclaw/workspace/audiobook-stories/。脚本支持任意绝对路径输入,但统一目录更方便程序化管理。
在执行任何主流程前,确保:
STEP_API_KEYffmpegffprobeaudiobook 现在建议显式调用,不建议依赖隐式注入;这是一个会读写本地文件、并可能访问外部 API 的工作流型 skill。voice-library.yaml -> llm.*.base_url,则会访问你自己配置的兼容 LLM endpoint。ffmpeg / ffprobe 请只从可信来源安装。clone_selected_voices.py;而且现在除了 selected_for_clone=true 之外,还必须显式传入 --confirm-paid-action 才会执行正式 clone。run_audiobook.py 默认只会对 clone 阶段做 --dry-run 预览,不会自动代替你执行正式付费 clone。references/security.md。如果本地还没有 voice-library.yaml,先用模板初始化:
mkdir -p "$LIBRARY_ROOT"
cp \
"$SKILL_ROOT/assets/voice-library.template.yaml" \
"$VOICE_LIBRARY"
如果你希望在第一次 ingest 前就看到带注释的人工审核骨架,也可以顺手初始化:
cp \
"$SKILL_ROOT/assets/voice-reviews.template.yaml" \
"$LIBRARY_ROOT/voice-reviews.yaml"
examples/ 目录现在提供 7 个轻量示例,适合先理解结构,再复制到自己的工作区继续改:
examples/story-minimal.txt:最小原始小说文本examples/story-minimal.structured-script.yaml:对应的最小结构化剧本examples/voice-library.minimal.yaml:最小音色库配置示例examples/voice-reviews.minimal.yaml:最小人工审核示例examples/story-minimal.casting-plan.yaml:最小可下游继续的选角结果示例examples/story-minimal.tts-requests.json:最小可 replay 的 TTS 请求示例examples/story-minimal.script-runtime.json:由 build_tts_requests.py 生成的规范化剧本 companion使用原则:
assets/*.template.yamlexamples/*minimal* 更适合“照着看结构”“复制局部片段”“给程序做字段对齐”examples/*.json / *.yaml 里的路径字段已经改成 $EXAMPLES_ROOT / $RUN_ROOT 占位,不包含本机绝对路径examples/voice-library.minimal.yaml 直接当成长期运行时库文件一次性跑完整主流程时,优先用:
python3 scripts/run_audiobook.py --library "$VOICE_LIBRARY" --story-input /绝对路径/小说.txt
这条命令会按顺序尝试:
--voice-input 或 --process-inbox 指定的新音频txt,先生成 structured-scriptcasting-review、casting-plan、clone-reviewtts-requests -> synthesize -> finalize如果你要分步执行,建议顺序见 references/workflows.md。
分析单条音频:
python3 scripts/sync_voice_library.py --library "$VOICE_LIBRARY" --input /绝对路径/参考音频.m4a
批量处理投递区:
python3 scripts/run_audiobook.py --library "$VOICE_LIBRARY" --story-input /绝对路径/小说.txt --process-inbox
只想批量处理投递区,不进入故事链路:
python3 scripts/run_audiobook.py --library "$VOICE_LIBRARY" --process-inbox --downstream-mode off
仅刷新官方音色:
python3 scripts/sync_voice_library.py --library "$VOICE_LIBRARY" --refresh-official-only
快速列出仍待人工确认的 clone 音色:
python3 scripts/list_pending_reviews.py --library "$VOICE_LIBRARY" --pretty
python3 scripts/generate_structured_script.py --library "$VOICE_LIBRARY" --input /绝对路径/小说.txt
默认输出:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.structured-script.yaml
python3 scripts/recommend_casting.py --library "$VOICE_LIBRARY" --input /绝对路径/structured-script.yaml
默认输出:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.casting-review.yaml~/.openclaw/workspace/runs/audiobook/<slug>/<base>.casting-plan.yaml~/.openclaw/workspace/runs/audiobook/<slug>/<base>.clone-review.yaml~/.openclaw/workspace/runs/audiobook/<slug>/.audiobook/<base>.casting-plan.role-profiles.json~/.openclaw/workspace/runs/audiobook/<slug>/.audiobook/<base>.casting-plan.casting-selection.jsonpython3 scripts/build_tts_requests.py --input /绝对路径/structured-script.yaml
默认输出:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.script-runtime.json~/.openclaw/workspace/runs/audiobook/<slug>/<base>.tts-requests.jsonpython3 scripts/synthesize_tts_requests.py --input /绝对路径/<base>.tts-requests.json
默认输出:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.segments/python3 scripts/finalize_audiobook.py --input /绝对路径/<base>.tts-requests.json
默认整本输出:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.audiobook.wav
如果你把 response_format 改成 mp3 / flac / opus,最终扩展名会跟着变化。默认值仍然是 wav。
如果只导出部分片段,会输出:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.preview-<segments>.<response_format>
每本书都有一份统一清单:
~/.openclaw/workspace/runs/audiobook/<slug>/<base>.artifacts.json
它会列出:
voice-reviews、effective-voice-library、voice-candidate-pool、official-voices-cachescript-runtime、tts-requestssegments/人类查看时:
python3 scripts/list_story_artifacts.py --manifest /绝对路径/<base>.artifacts.json --level review --pretty
程序调用时:直接读取 artifacts.json 即可,不需要硬编码路径推导。
如果你只想快速看音色库里还有哪些 clone 描述待人工确认,用:
python3 scripts/list_pending_reviews.py --library "$VOICE_LIBRARY" --pretty
建议人工编辑的文件:
voice-reviews.yaml*.casting-review.yaml*.clone-review.yaml*.structured-script.yaml*.tts-requests.json不建议直接编辑的生成文件:
.audiobook/effective-voice-library.yaml.audiobook/voice-candidate-pool.yaml.audiobook/official-voices-cache.json*.casting-plan.yaml(除非你明确知道自己在做什么)*.script-runtime.json*.artifacts.json改完后的重跑命令见 references/editing.md。
.audiobook/ 的区别这是最容易混淆的点:
~/.openclaw/workspace/audiobook-library/.audiobook/:音色库侧生成文件~/.openclaw/workspace/runs/audiobook/<slug>/.audiobook/:某本书本次运行的 trace / debug 文件前者服务整个音色库;后者只服务单次故事流程。
clone_selected_voices.py 是唯一会触发付费 clone 的步骤。默认流程只会:
clone-review.yaml 里等待确认真正执行前请先跑:
python3 scripts/clone_selected_voices.py --library "$VOICE_LIBRARY" --dry-run
正式执行时,现在必须额外确认:
python3 scripts/clone_selected_voices.py --library "$VOICE_LIBRARY" --confirm-paid-action
下面这些脚本都输出 JSON 到 stdout,适合程序调用:
sync_voice_library.pygenerate_structured_script.pyrecommend_casting.pybuild_tts_requests.pysynthesize_tts_requests.pyfinalize_audiobook.pyrun_audiobook.py对程序来说,最稳的组合是:
artifacts.json 拿完整文件清单如果你是人类用户,建议优先看中文;如果你是英文环境下的 agent 或程序,可直接读对应的英文 companion 文档。
references/workflows.md|English references/workflows.en.mdreferences/voice-library.md|English references/voice-library.en.mdreferences/script-format.md|English references/script-format.en.mdreferences/casting.md|English references/casting.en.mdreferences/synthesis.md|English references/synthesis.en.mdreferences/editing.md|English references/editing.en.mdreferences/security.md|English references/security.en.md如果你只是想快速进入某个主题,推荐顺序是:
references/workflows.mdreferences/voice-library.mdreferences/editing.md