# 获取乐器音轨（MIDI）

**这是什么**：把一首歌拆成多条音轨（人声、鼓、贝斯、其它乐器等），并可获取乐器 MIDI。

**什么时候用**：需要做精细混音、重新编曲或拿乐器 MIDI 时用。

## 接口地址
- POST `/api/cqt/generator/suno` (task: `gen_stem_all`)
- GET `/api/cqt/info/suno?id={taskId}`

## 请求参数
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| task | string | 是 | 固定填 gen_stem_all |
| clipId | string | 是 | 要分离的歌曲片段 ID |

## 请求示例
```bash
curl -X POST https://api.novapi.ai/api/cqt/generator/suno \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{ "task":"gen_stem_all", "clipId":"05d72140-38f5-4eb4-bdaa-a6e0d1c1167e" }'
# -> { "code":200, "data":"<taskId>" }
```

## 响应示例
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "id": "b1405dadb0374f29a87a5657bc89f952",
    "taskType": "gen_stem_all",
    "status": "succeeded",
    "errorMsg": "",
    "param": { "task": "gen_stem_all", "clipId": "05d72140-38f5-4eb4-bdaa-a6e0d1c1167e" },
    "result": [
      {
        "id": "bd83b47f-e4e1-4a14-a01f-a97e4206fbe6",
        "title": " (Vocals)",
        "status": "complete",
        "metadata": {
          "task": "gen_stem",
          "type": "gen",
          "duration": 167.36,
          "is_remix": true,
          "stem_task": "twelve",
          "stem_from_id": "05d72140-38f5-4eb4-bdaa-a6e0d1c1167e",
          "stem_type_id": 91,
          "edited_clip_id": "05d72140-38f5-4eb4-bdaa-a6e0d1c1167e",
          "secondary_badges": [
            { "icon_key": "stem", "display_name": "Stem",
              "dark": { "text_color": "A3A3A3", "border_color": "00000000", "background_color": "FFFFFF0C" },
              "light": { "text_color": "7D7C83", "border_color": "00000000", "background_color": "1C1C1F0A" } }
          ],
          "stem_type_group_name": "Vocals"
        },
        "audio_url": "https://cdn1.suno.ai/bd83b47f-e4e1-4a14-a01f-a97e4206fbe6.mp3",
        "image_url": "https://cdn2.suno.ai/image_bd83b47f-e4e1-4a14-a01f-a97e4206fbe6.jpeg",
        "model_name": "chirp-ahi",
        "batch_index": 0,
        "created_at": "2026-01-09T12:17:22.932Z",
        "major_model_version": "v4.5"
      },
      { "id": "1494b458-...", "title": " (Backing Vocals)", "audio_url": "https://cdn1.suno.ai/1494b458-....mp3", "batch_index": 1 },
      { "id": "d2917197-...", "title": " (Drums)",          "audio_url": "https://cdn1.suno.ai/d2917197-....mp3", "batch_index": 2 },
      { "id": "6ff067b2-...", "title": " (Bass)",           "audio_url": "https://cdn1.suno.ai/6ff067b2-....mp3", "batch_index": 3 },
      { "id": "5b8c4bf3-...", "title": " (Guitar)",         "audio_url": "https://cdn1.suno.ai/5b8c4bf3-....mp3", "batch_index": 4 },
      { "id": "5e6f8f57-...", "title": " (Keyboard)",       "audio_url": "https://cdn1.suno.ai/5e6f8f57-....mp3", "batch_index": 5 },
      { "id": "8c5ec56d-...", "title": " (Percussion)",     "audio_url": "https://cdn1.suno.ai/8c5ec56d-....mp3", "batch_index": 6 },
      { "id": "f6e1121a-...", "title": " (Strings)",        "audio_url": "https://cdn1.suno.ai/f6e1121a-....mp3", "batch_index": 7 },
      { "id": "7ff03494-...", "title": " (Synth)",          "audio_url": "https://cdn1.suno.ai/7ff03494-....mp3", "batch_index": 8 },
      { "id": "c5ca419a-...", "title": " (FX)",             "audio_url": "https://cdn1.suno.ai/c5ca419a-....mp3", "batch_index": 9 },
      { "id": "9121a113-...", "title": " (Brass)",          "audio_url": "https://cdn1.suno.ai/9121a113-....mp3", "batch_index": 10 },
      { "id": "444f89cf-...", "title": " (Woodwinds)",      "audio_url": "https://cdn1.suno.ai/444f89cf-....mp3", "batch_index": 11 }
    ]
  }
}
```

## 响应字段说明
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| code | number | 状态码，200 表示成功 |
| msg | string | 提示信息 |
| data.id | string | 任务 ID（= 提交时拿到的 taskId，用于轮询查询） |
| data.taskType | string | 任务类型，恒为 gen_stem_all |
| data.status | string | 任务状态：pending 处理中 / succeeded 成功 / failed 失败 |
| data.errorMsg | string | 失败原因，成功时为空 |
| data.param | object | 原样回显你提交的请求参数 |
| data.result | array | 分离出的音轨数组（人声/鼓/贝斯/吉他/键盘等，通常 12 条） |
| data.result[].id | string | 该音轨的 clipId，可继续用于导出等 |
| data.result[].title | string | 音轨名称，如 " (Vocals)" / " (Drums)" / " (Bass)" |
| data.result[].audio_url | string | 该音轨的音频地址（mp3） |
| data.result[].batch_index | number | 音轨序号（0=Vocals … 递增到最后一条） |
| data.result[].metadata.stem_type_group_name | string | 音轨类别，如 Vocals / Drums / Bass |
| data.result[].metadata.duration | number | 音轨时长（秒） |
| data.result[].status | string | 音轨状态，complete 表示可下载 |

## OpenAI 协议写法
同一个 task 也可用 `POST /v1/audio/generations` 调用（body 加 `task: "gen_stem_all"`，model 写成 suno-v6 形式），用 `GET /v1/audio/generations/{id}` 轮询，非音频类结果在 `result` 字段。

```bash
curl -X POST https://api.novapi.ai/v1/audio/generations \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "suno",
  "task": "gen_stem_all",
  "clipId": "05d72140-38f5-4eb4-bdaa-a6e0d1c1167e"
}'
# -> { "id":"audio_<taskId>", "object":"audio.generation", "status":"queued", ... }
# poll: GET https://api.novapi.ai/v1/audio/generations/audio_<taskId>
```
