SuperAPI AI 工具集

acestep-lyrics-transcription

写作与研究

查看项目

更新于 10-15 10:28

技能介绍

用途

acestep-lyrics-transcription 是一个歌词转写技能,用于将音频文件转写为带时间戳的歌词。它通过调用 OpenAI Whisper 或 ElevenLabs Scribe API 完成语音识别,输出 LRC、SRT 或 JSON 格式,支持词级时间戳。该技能适合在制作 MV 等需要同步歌词的场景中使用。

主要能力

  • 将音频文件转写为带时间戳的歌词。
  • 支持多种输出格式:LRC、SRT、JSON。
  • 支持词级时间戳。
  • 支持多语言转写(通过 --language 指定语言代码,如 zh、en、ja)。
  • 支持在两个 API 提供商之间切换:OpenAI 和 ElevenLabs。

使用方式

前置条件

需要安装 curl、jq、python3(或 python),并拥有 OpenAI 或 ElevenLabs 的 API Key。

API Key 检查与配置

使用前必须检查 API Key 是否已配置。运行以下命令检查(该命令只报告当前提供商的 API Key 是否已设置或为空,不会打印实际 Key 值):

cd "{project_root}/{.claude or .codex}/skills/acestep-lyrics-transcription/" && bash ./scripts/acestep-lyrics-transcription.sh config --check-key

如果报告 Key 为空,必须停止并引导用户配置,不能在没有有效 Key 的情况下尝试转写。配置 API Key 的命令:

cd "{project_root}/{.claude or .codex}/skills/acestep-lyrics-transcription/" && bash ./scripts/acestep-lyrics-transcription.sh config --set <provider>.api_key <KEY>

如需切换提供商,运行:

cd "{project_root}/{.claude or .codex}/skills/acestep-lyrics-transcription/" && bash ./scripts/acestep-lyrics-transcription.sh config --set provider <provider_name>

配置后重新运行 config --check-key 验证 Key 已设置,再继续。如果 Key 已配置,可直接进行转写。

快速开始

# 1. cd 到此技能目录
cd {project_root}/{.claude or .codex}/skills/acestep-lyrics-transcription/

# 2. 配置 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

# 3. 转写
./scripts/acestep-lyrics-transcription.sh transcribe --audio /path/to/song.mp3 --language zh

# 4. 输出保存到:{project_root}/acestep_output/<filename>.lrc

脚本用法

./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)

转写后的歌词校对(强制)

转写后必须手动修正 LRC 文件,再用于 MV 渲染。转写模型在演唱歌词上经常出错,例如:

  • 专有名词:"ACE-Step" 被识别为 "AC step","Spotify" 被识别为 "spot a fly"
  • 近音词:"arrives" 被识别为 "eyes","open source" 被识别为 "open sores"
  • 单词合并或拆分:"lighting up" 被识别为 "lightin' nup"

校对流程:

  1. 使用 Read 工具读取转写后的 LRC 文件。
  2. 读取 ACE-Step 输出 JSON 文件中的原始歌词。
  3. 以原始歌词整体为参考:不要尝试逐行对齐,转写常会以不同方式拆分、合并或重排行。应通读原始歌词理解正确措辞,再逐行检查 LRC 并修正识别错误的词。
  4. 修正转写错误:将识别错误的词替换为原始歌词中的正确词,保持时间戳不变。
  5. 使用 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.

配置

配置文件:scripts/config.json

# 切换提供商
./scripts/acestep-lyrics-transcription.sh config --set provider openai
./scripts/acestep-lyrics-transcription.sh config --set provider elevenlabs

# 设置 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 --list

配置项:

  • provider:默认 openai。当前提供商:openai 或 elevenlabs。
  • output_format:默认 lrc。默认输出格式:lrc、srt 或 json。
  • openai.api_key:默认 ""。OpenAI API Key。
  • openai.api_url:默认 https://api.openai.com/v1。OpenAI API 基础 URL。
  • openai.model:默认 whisper-1。OpenAI 模型(whisper-1 支持词级时间戳)。
  • elevenlabs.api_key:默认 ""。ElevenLabs API Key。
  • elevenlabs.api_url:默认 https://api.elevenlabs.io/v1。ElevenLabs API 基础 URL。
  • elevenlabs.model:默认 scribe_v2。ElevenLabs 模型。

提供商说明

  • OpenAI:模型 whisper-1,支持词级时间戳(segment + word),价格为 $0.006/min。whisper-1 是唯一支持词级时间戳的 OpenAI 模型。
  • ElevenLabs:模型 scribe_v2,支持词级时间戳(word-level),价格因套餐而异。scribe_v2 返回词级时间戳并支持类型过滤。
  • 两者均支持多语言转写。

示例

# 基本转写(使用配置默认值)
./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

适用场景与限制

适用场景:需要将歌曲或音频转为带时间戳歌词文件,用于 MV 渲染或其他同步歌词需求。

限制:

  • 需要有效的 OpenAI 或 ElevenLabs API Key,否则无法转写。
  • 转写模型在演唱歌词上容易出错,必须进行人工校对。
  • OpenAI 仅 whisper-1 支持词级时间戳。
  • ElevenLabs 价格因套餐而异,资料未提供具体价格细节。