Hoppa till huvudinnehåll
SUNO tillåter oss att göra en andra skapelse av den genererade musiken och hämta musikens MIDI. Detta dokument förklarar hur man integrerar relaterade API:er. Den centrala indata-parametern för API:et är audio_id, vilket är det officiellt genererade låt-ID:t, vanligtvis ett ID för en låt med full spårseparation (motsvarande låtgenerering där parametern action är all_stems). Valfritt stöder det även callback_url för asynkron återkoppling. Här är vårt inmatade audio_id: c65e6ffd-ead3-4926-9c8c-a42ce202946b.
import requests

url = "https://api.acedata.cloud/suno/midi"

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

payload = {
    "audio_id": "c65e6ffd-ead3-4926-9c8c-a42ce202946b"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
Resultatet är som följer:
  "success": true,
  "task_id": "4f94486d-5013-4bcc-922f-39bd52b5cd4a",
  "trace_id": "8bc8cca3-2d4b-46d0-a4fa-bb355af9902c",
  "data": [
    {
      "state": "complete",
      "instruments": [
        {
          "name": "Synth Voice",
          "notes": [
            {
              "pitch": 55,
              "start": 29.78125,
              "end": 31.78125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 52,
              "start": 32.807291666666664,
              "end": 32.9375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 32.9375,
              "end": 33.067708333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 33.296875,
              "end": 33.427083333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 33.697916666666664,
              "end": 33.828125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 34.098958333333336,
              "end": 34.229166666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 34.505208333333336,
              "end": 34.635416666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 34.90625,
              "end": 35.036458333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 35.307291666666664,
              "end": 35.4375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 35.708333333333336,
              "end": 35.838541666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 36.109375,
              "end": 37.28125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 38.109375,
              "end": 38.239583333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 38.510416666666664,
              "end": 38.640625,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 38.875,
              "end": 39.401041666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 39.9375,
              "end": 40.067708333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 40.338541666666664,
              "end": 40.46875,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 40.739583333333336,
              "end": 40.869791666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 41.140625,
              "end": 41.270833333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 41.541666666666664,
              "end": 41.671875,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 41.942708333333336,
              "end": 42.072916666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 52,
              "start": 42.34375,
              "end": 43.395833333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 44.708333333333336,
              "end": 44.869791666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 45.109375,
              "end": 45.270833333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 45.510416666666664,
              "end": 45.671875,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 45.875,
              "end": 46.432291666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 46.65625,
              "end": 46.828125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 47.057291666666664,
              "end": 47.229166666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 47.458333333333336,
              "end": 47.635416666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 47.859375,
              "end": 48.385416666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 49.875,
              "end": 50.005208333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 50.276041666666664,
              "end": 50.40625,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 50.677083333333336,
              "end": 51.203125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 51.703125,
              "end": 51.833333333333336,
              "velocity": 0.49606299212598426
            },
{
              "pitch": 60,
              "start": 52.104166666666664,
              "end": 52.234375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 52.505208333333336,
              "end": 52.635416666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 53.046875,
              "end": 53.239583333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 53.447916666666664,
              "end": 54.036458333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 54.229166666666664,
              "end": 54.359375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 54.630208333333336,
              "end": 54.760416666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 55.03125,
              "end": 55.161458333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 55.651041666666664,
              "end": 55.796875,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 56.067708333333336,
              "end": 56.197916666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 56.46875,
              "end": 56.598958333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 69,
              "start": 56.869791666666664,
              "end": 57.130208333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 57.130208333333336,
              "end": 57.921875,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 58.213541666666664,
              "end": 58.34375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 58.614583333333336,
              "end": 58.744791666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 59.015625,
              "end": 59.145833333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 59.416666666666664,
              "end": 59.942708333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 61.510416666666664,
              "end": 61.640625,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 61.640625,
              "end": 62.036458333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 62.234375,
              "end": 62.364583333333336,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 62.635416666666664,
              "end": 62.765625,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 62.765625,
              "end": 63.557291666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 63.71875,
              "end": 63.854166666666664,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 64.11458333333333,
              "end": 64.25520833333333,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 64.51041666666667,
              "end": 64.65625,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 64.91145833333333,
              "end": 65.05729166666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 65.3125,
              "end": 65.85416666666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 67.35416666666667,
              "end": 67.484375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 67.75520833333333,
              "end": 67.88541666666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 68.15104166666667,
              "end": 68.28125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 69,
              "start": 68.546875,
              "end": 68.80729166666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 68.80729166666667,
              "end": 68.9375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 69.203125,
              "end": 69.72916666666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 69.92708333333333,
              "end": 70.05729166666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 70.328125,
              "end": 70.45833333333333,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 70.72916666666667,
              "end": 70.859375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 71.13020833333333,
              "end": 71.65625,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 57,
              "start": 73.203125,
              "end": 73.47395833333333,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 73.46875,
              "end": 73.60416666666667,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 73.609375,
              "end": 73.73958333333333,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 55,
              "start": 73.86979166666667,
              "end": 74.265625,
              "velocity": 0.49606299212598426
            },
{
              "pitch": 60,
              "start": 74.31770833333333,
              "end": 74.578125,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 74.52083333333333,
              "end": 75.63020833333333,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 64,
              "start": 75.765625,
              "end": 75.9375,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 62,
              "start": 76.16666666666667,
              "end": 76.296875,
              "velocity": 0.49606299212598426
            }, {
              "pitch": 60,
              "start": 76.56770833333333,
              "end": 76.69791666666667,
              "velocity": 0.49606299212598426
            },
            {
              "pitch": 57,
              "start": 76.96354166666667,
              "end": 78.96354166666667,
              "velocity": 0.49606299212598426
            }
          ]
        },
        ....
      ]
    }
  ]
}
Det kan ses att fälten i data är MIDI-informationen för låten efter att hela ljudspåret har separerats.