Skip to content

Suno 歌词时间轴

根据歌曲 ID 获取歌词与音频的时间轴信息。该接口常用于定位某句歌词的起止时间,后续可配合 replace_section 进行片段替换。

接口地址

http
POST /suno/timing

请求参数

参数类型必填默认值说明
audio_idstring-需要获取歌词时间轴的歌曲 ID
async_modebooleanfalse是否使用异步模式

请求示例

json
{
  "audio_id": "222fbe29-6bdb-4344-8f50-d9131304b86b",
  "async_mode": false
}

Python 示例

python
import requests

url = "https://api.yoy-ai.com/suno/timing"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json",
}

payload = {
    "audio_id": "222fbe29-6bdb-4344-8f50-d9131304b86b"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)

响应说明

常见字段如下:

字段说明
success请求是否成功
task_id任务 ID
trace_id请求追踪 ID,排查问题时可一并提供
data.aligned_words按词或短语对齐的时间轴列表
data.aligned_words[].word对齐的歌词文本
data.aligned_words[].start_s该词或短语在音频中的开始时间,单位为秒
data.aligned_words[].end_s该词或短语在音频中的结束时间,单位为秒
data.aligned_words[].p_align对齐置信度
data.waveform_data音频波形采样数据,可用于绘制波形
data.aligned_lyrics按歌词行聚合后的时间轴列表
data.aligned_lyrics[].text歌词行文本
data.aligned_lyrics[].start_s该歌词行开始时间,单位为秒
data.aligned_lyrics[].end_s该歌词行结束时间,单位为秒
data.aligned_lyrics[].words当前歌词行下的逐字时间信息

在片段替换场景中,可以根据 aligned_wordsaligned_lyrics 中的 start_send_s 选择 replace_section_startreplace_section_end

响应示例

json
{
  "success": true,
  "task_id": "c3e02d42-24af-45c1-84f8-80d2b7fc115f",
  "trace_id": "39f20a96-6ce1-499e-84d2-ba4cbda8324d",
  "data": {
    "aligned_words": [
      {
        "word": "一汗一热血\n\n",
        "success": true,
        "start_s": 26.40957,
        "end_s": 32.75266,
        "p_align": 0.99
      },
      {
        "word": "(Chorus)",
        "success": true,
        "start_s": 90.71809,
        "end_s": 93.27128,
        "p_align": 0.99
      },
      {
        "word": "就是旰!\n\n",
        "success": true,
        "start_s": 93.31117,
        "end_s": 93.65027,
        "p_align": 0.99
      }
    ],
    "waveform_data": [
      0.00008,
      0.00003,
      0.00259,
      0.03154
    ],
    "hoot_cer": 0.7681660899653979,
    "is_streamed": false,
    "aligned_lyrics": [
      {
        "text": "一汗一热血",
        "start_s": 26.409574468085108,
        "end_s": 30.79787234042553,
        "section": "",
        "words": [
          {
            "text": "一",
            "start_s": 26.409574468085108,
            "end_s": 26.48936170212766
          },
          {
            "text": "汗",
            "start_s": 29.601063829787233,
            "end_s": 29.680851063829788
          }
        ]
      },
      {
        "text": "(Chorus)整起,整起就整起!",
        "start_s": 108.51063829787235,
        "end_s": 111.62234042553192,
        "section": "",
        "words": [
          {
            "text": "(Chorus)",
            "start_s": 108.51063829787235,
            "end_s": 108.59042553191489
          },
          {
            "text": "整",
            "start_s": 108.59042553191489,
            "end_s": 108.75
          }
        ]
      }
    ]
  }
}

扣费说明

功能参考积分
歌词时间轴1