suno-api icon indicating copy to clipboard operation
suno-api copied to clipboard

How can I generate music without lyrics?

Open HoJ00n2 opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. I want to generate only music using custom mode. So I sent a POST request to custom_generate and set make_instrumental to true. However, as soon as I put the requirements in the prompt, the prompt gets included in the lyrics. Actually, in Suno, the style of music matches the tags in this API, so I tried putting it only in the tags, but then an error occurs because there is no prompt and it fails to generate. I would appreciate it if you could tell me how to fix this.

Describe the solution you'd like If there is a way to generate only music, please let me know. If not, it would be great if you could make it so that generation works even when the requirements are included in the tags and the prompt is left empty.

And I would like to request not only through prompts but also by inserting an original music file and changing its styling. I'm curious if the feature to upload music files is supported.

Additional context here is my Code

answer = {'prompt': 'Create an exciting rock music track with prominent electric guitar and drum sounds.', 'tags': 'exciting, rock, music, electric guitar, drums', 'make_instrumental': True}

def custom_generate_audio(payload):
    print(f"payload: {payload}")
    url = f"{base_url}/api/custom_generate"
    response = requests.post(url, json=payload, headers={'Content-Type': 'application/json'})
    return response.json()

custom_generate_audio(answer)

create result image

HoJ00n2 avatar Sep 22 '24 03:09 HoJ00n2

I can also confirm that there is a problem downstream, somewhere in the API. I've been having the exact same problems as @HoJ00n2 and from looking at logs, it looks like the payload IS sending the flag make_instrumental set to True in the payload during the generateSongs method.

generateSongs payload:

{
  "prompt": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
  "isCustom": true,
  "tags": "Epic LoFi Orchestra",
  "title": "Treasure Hunt",
  "make_instrumental": true,
  "wait_audio": true,
  "payload": {
    "make_instrumental": true,
    "mv": "chirp-v3-5",
    "prompt": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
    "tags": "Epic LoFi Orchestra",
    "title": "Treasure Hunt"
  }
}

This is the generateSongs Response:

{
  "id": "<redacted>",
  "clips": [
    {
      "id": "<redacted>",
      "video_url": "",
      "audio_url": "",
      "is_video_pending": false,
      "major_model_version": "v3",
      "model_name": "chirp-v3",
      "metadata": {
        "tags": "Epic LoFi Orchestra",
        "prompt": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
        "type": "gen",
        "stream": true
      },
      "is_liked": false,
      "user_id": "<redacted>",
      "display_name": "<redacted>",
      "handle": "<redacted>",
      "is_handle_updated": false,
      "avatar_image_url": "https://cdn1.suno.ai/defaultOrange.webp",
      "is_trashed": false,
      "created_at": "2024-09-21T22:52:36.375Z",
      "status": "submitted",
      "title": "Treasure Hunt",
      "play_count": 0,
      "upvote_count": 0,
      "is_public": false
    },
    {
      "id": "<redacted>",
      "video_url": "",
      "audio_url": "",
      "is_video_pending": false,
      "major_model_version": "v3",
      "model_name": "chirp-v3",
      "metadata": {
        "tags": "Epic LoFi Orchestra",
        "prompt": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
        "type": "gen",
        "stream": true
      },
      "is_liked": false,
      "user_id": "<redacted>",
      "display_name": "<redacted>",
      "handle": "<redacted>",
      "is_handle_updated": false,
      "avatar_image_url": "<redacted>",
      "is_trashed": false,
      "created_at": "2024-09-21T22:52:36.375Z",
      "status": "submitted",
      "title": "Treasure Hunt",
      "play_count": 0,
      "upvote_count": 0,
      "is_public": false
    }
  ],
  "metadata": {
    "tags": "Epic LoFi Orchestra",
    "prompt": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
    "type": "gen",
    "stream": true
  },
  "major_model_version": "v3",
  "status": "complete",
  "created_at": "2024-09-21T22:52:36.297Z",
  "batch_size": 1
}

However, when Custom Generate Response comes back, it reports lyrics being created in its logs:

  {
    "id": "<redacted>",
    "title": "Treasure Hunt",
    "image_url": "<redacted>",
    "lyric": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
    "audio_url": "<redacted>",
    "video_url": "",
    "created_at": "2024-09-21T22:52:36.375Z",
    "model_name": "chirp-v3.5",
    "status": "streaming",
    "prompt": "Create a song with a sense of urgency and excitement, evoking the feeling of searching for a hidden treasure while navigating through dense jungle foliage.",
    "type": "gen",
    "tags": "Epic LoFi Orchestra"
  },

mauricio-gg avatar Sep 22 '24 07:09 mauricio-gg

After a second look, I have more questions about this... it looks like generateSongs doesn't even take a lyrics param, which is strange considering that generating custom songs in Suno allows you to pass lyrics to use. Looking at the number of input textboxes available to us in suno and comparing those to the API implementation, I think I found the problem:

prompt maps to --> lyrics
tags maps to --> style of music
title maps to --> title (duh)

Will confirm in a few moments. If this was the problem then it is just a problem about ambiguity :)

mauricio-gg avatar Sep 22 '24 08:09 mauricio-gg

Can confirm that was the problem. prompt needs to be passed as an empty string and the tags field should be used for the style of music (ie what we could call a "prompt")

mauricio-gg avatar Sep 22 '24 09:09 mauricio-gg

I had the same issue and had to figure it out. @mauricio-gg is completely right with the approach. Empty prompt is the way

Alazka2k avatar Sep 26 '24 16:09 Alazka2k