用途
本技能用于将音频文件转写为带时间戳的歌词,输出格式支持 LRC、SRT 或 JSON,并可包含词级时间戳。适合需要为歌曲生成同步歌词、字幕或后续 MV 渲染准备的场景。
主要能力
- 通过 OpenAI Whisper 或 ElevenLabs Scribe API 进行音频转写。
- 输出 LRC、SRT、JSON 三种格式,默认 LRC。
- 支持词级时间戳:OpenAI 使用 whisper-1 模型(同时支持 segment 与 word 时间戳),ElevenLabs 使用 scribe_v2 模型(词级时间戳,带类型过滤)。
- 支持多语言转写,可通过 --language 指定语言代码(如 zh、en、ja)。
- 可切换服务商,并覆盖配置中的默认服务商与输出格式。
使用方式
前置条件:需要 curl、jq、python3(或 python),以及 OpenAI 或 ElevenLabs 的 API Key。
配置 API Key(二选一):
./scripts/acestep-lyrics-transcription.sh config --set openai.api_key sk-...
# 或
./scripts/acestep-lyrics-transcription.sh config --set elevenlabs.api_key ...
./scripts/acestep-lyrics-transcription.sh config --set provider elevenlabs
检查 Key 是否已配置(仅报告是否为空,不显示实际值):
cd "{project_root}/{.claude or .codex}/skills/acestep-lyrics-transcription/" && bash ./scripts/acestep-lyrics-transcription.sh config --check-key
转写命令:
./scripts/acestep-lyrics-transcription.sh transcribe --audio <file> [options]
选项:
- -a, --audio:音频文件路径(必填)
- -l, --language:语言代码(zh、en、ja 等)
- -f, --format:输出格式 lrc、srt、json(默认 lrc)
- -p, --provider:API 服务商 openai、elevenlabs(覆盖配置)
- -o, --output:输出文件路径(默认 acestep_output/<filename>.lrc)
示例:
# 基础转写(使用配置默认值)
./scripts/acestep-lyrics-transcription.sh transcribe --audio song.mp3
# 中文歌曲转 LRC
./scripts/acestep-lyrics-transcription.sh transcribe --audio song.mp3 --language zh
# 使用 ElevenLabs,输出 SRT
./scripts/acestep-lyrics-transcription.sh transcribe --audio song.mp3 --provider elevenlabs --format srt
# 自定义输出路径
./scripts/acestep-lyrics-transcription.sh transcribe --audio song.mp3 --output ./my_lyrics.lrc
配置项(配置文件 scripts/config.json):
- provider:默认 openai,可选 openai 或 elevenlabs
- output_format:默认 lrc,可选 lrc、srt、json
- openai.api_key:默认空
- openai.api_url:默认 https://api.openai.com/v1
- openai.model:默认 whisper-1
- elevenlabs.api_key:默认空
- elevenlabs.api_url:默认 https://api.elevenlabs.io/v1
- elevenlabs.model:默认 scribe_v2
查看配置(会自动将 API Key 掩码为 ***):
./scripts/acestep-lyrics-transcription.sh config --list
转写后歌词校正(强制步骤)
转写完成后,必须在使用 LRC 文件进行 MV 渲染前手动校正。转写模型对演唱歌词常出现错误,例如:
- 专有名词:"ACE-Step" → "AC step","Spotify" → "spot a fly"
- 近音词:"arrives" → "eyes","open source" → "open sores"
- 词合并/拆分:"lighting up" → "lightin' nup"
校正流程:
- 使用 Read 工具读取转写后的 LRC 文件。
- 读取 ACE-Step 输出 JSON 文件中的原始歌词。
- 以原始歌词整体作为参考:不要逐行对齐,转写常会拆分、合并或重排行;应先通读原始歌词理解正确措辞,再逐行扫描 LRC 并修正误识别的词。
- 用正确的原始词替换误识别词,保持时间戳不变。
- 使用 Write 工具写回校正后的 LRC。
校正要点:
- 用正确的原始词替换误识别词。
- 保持所有 [MM:SS.cc] 时间戳原样不变(转写时间戳是准确的)。
- 不要添加 [Verse]、[Chorus] 等结构标签,LRC 只应包含带时间戳的文本行。
示例:
转写(错误):
[00:46.96]AC step alive,
[00:50.80]one point five eyes.
原始歌词参考:
ACE-Step alive
One point five arrives
校正后(正确):
[00:46.96]ACE-Step alive,
[00:50.80]One point five arrives.
适用场景
- 为歌曲生成同步歌词文件(LRC/SRT)。
- 为 MV 渲染准备带时间戳的歌词。
- 需要词级时间戳的歌词或字幕输出。
- 多语言歌曲的歌词转写。
限制与注意事项
- 必须配置有效的 API Key,否则转写会失败;Key 为空时应先引导用户配置。
- 不要读取或显示用户的 API Key 内容,不要对 key 字段使用 config --get,也不要直接读取 config.json;config --list 是安全的,会自动掩码。
- 转写模型对演唱歌词易出错,转写后必须人工校正。
- OpenAI whisper-1 是唯一支持词级时间戳的 OpenAI 模型。
- 定价:OpenAI Whisper API 约 $0.006/分钟;ElevenLabs 定价随套餐而异,免费层包含有限额度。
- 获取 Key 的地址:OpenAI https://platform.openai.com/api-keys(需启用计费的 OpenAI 账户);ElevenLabs https://elevenlabs.io/app/settings/api-keys(需 ElevenLabs 账户)。