> ## Documentation Index
> Fetch the complete documentation index at: https://help.soundverse.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Extend Music - v6

> Extend existing music tracks by adding more content to either side of the track.

import React from 'react';

export const Method = ({ type, children }) => {
  const styles = {
    GET: {
      backgroundColor: "#2563eb",
      color: "white",
      padding: "3px 6px",
      borderRadius: "6px",
      fontSize: "1rem",
      fontWeight: "bold",
      display: "inline-block",
    },
    POST: {
      backgroundColor: "#16a34a",
      color: "white",
      padding: "3px 6px",
      borderRadius: "6px",
      fontSize: "1rem",
      fontWeight: "bold",
      display: "inline-block",
    },
  };

  return <span style={styles[type] || styles.GET}>{children || type}</span>;
};

## **Extend AI Music (v6)**

* The API supports only synchronous responses

### **Endpoint**

* <Method type="POST">POST</Method> `/v6/extend/music`

***

### **Request Parameters**

| Parameter          | Type    | Description                                                  | Required | Default Value |
| ------------------ | ------- | ------------------------------------------------------------ | -------- | ------------- |
| `audio_url`        | string  | URL of the audio file to extend.                             | Yes      | N/A           |
| `prompt`           | string  | Prompt for guiding the extension.                            | No       | N/A           |
| `duration`         | integer | Duration to extend in seconds.                               | No       | 30            |
| `side`             | string  | Which side to extend: `left` or `right`.                     | No       | right         |
| `styleOfMusic`     | string  | Musical style to guide the extension.                        | No       | N/A           |
| `inferStep`        | integer | Number of inference steps (higher = better quality, slower). | No       | N/A           |
| `guidanceScale`    | float   | Guidance scale for prompt adherence (1.0-15.0).              | No       | N/A           |
| `omegaScale`       | float   | Omega scale for audio quality refinement.                    | No       | N/A           |
| `retakeVariance`   | float   | Variance for regeneration attempts.                          | No       | N/A           |
| `refAudioStrength` | float   | Reference audio influence strength (0.0-1.0).                | No       | N/A           |
| `manualSeeds`      | array   | Manual seeds for reproducible outputs.                       | No       | N/A           |

### **Example Request**

```json theme={null}
{
  "audio_url": "https://storage.soundverse.ai/.../original_music.mp3",
  "prompt": "Add a climactic orchestral section",
  "duration": 30,
  "side": "right",
  "styleOfMusic": "orchestral",
  "guidanceScale": 7.5
}
```

### **Code Examples**

<CodeGroup>
  ```python 🐍 Python theme={null}
  import requests

  url = "https://api.soundverse.ai/v6/extend/music/sync"
  headers = {
    "Authorization": "Bearer your_api_key_here",
    "Content-Type": "application/json"
  }
  payload = {
    "audio_url": "https://storage.soundverse.ai/.../original_music.mp3",
    "prompt": "Add a climactic orchestral section",
    "duration": 30,
    "side": "right",
    "styleOfMusic": "orchestral",
    "guidanceScale": 7.5
  }

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

  ```javascript ⚡ JavaScript theme={null}
  const url = "https://api.soundverse.ai/v6/extend/music/sync";
  const headers = {
    Authorization: "Bearer your_api_key_here",
    "Content-Type": "application/json",
  };
  const payload = {
    audio_url: "https://storage.soundverse.ai/.../original_music.mp3",
    prompt: "Add a climactic orchestral section",
    duration: 30,
    side: "right",
    styleOfMusic: "orchestral",
    guidanceScale: 7.5,
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload),
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```

  ```bash 💻 cURL theme={null}
  curl -X POST "https://api.soundverse.ai/v6/extend/music/sync" \
    -H "Authorization: Bearer your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "audio_url": "https://storage.soundverse.ai/.../original_music.mp3",
      "prompt": "Add a climactic orchestral section",
      "duration": 30,
      "side": "right",
      "styleOfMusic": "orchestral",
      "guidanceScale": 7.5
    }'
  ```
</CodeGroup>

### **Response**

#### **Sample Synchronous Output**

```json theme={null}
{
  "message_id": "...",
  "album_art": "https://storage.soundverse.ai/soundverse-album-art/...album_art.png",
  "audio_data": [
    {
      "audio_url": "https://storage.soundverse.ai/x-one/.../.../extended_music.mp3",
      "song_name": "Extended Music Track",
      "licenses": {
        "licenses": "Royalty Free"
      }
    }
  ],
  "ai_reply": "Your music has been extended successfully."
}
```

### **Possible Errors**

**Rate Limit Exceeded:**

```json theme={null}
{
  "success": false,
  "message": "Rate limits have been passed for the user."
}
```

**Insufficient Balance:**

```json theme={null}
{
  "success": false,
  "message": "Insufficient balance for this operation."
}
```

**Invalid Prompt:**

```json theme={null}
{
  "detail": "Invalid or empty prompt provided"
}
```

**NSFW Content Detected:**

```json theme={null}
{
  "success": false,
  "message": "NSFW words detected. Please try again with different lyrics."
}
```

**Service Unavailable:**

```json theme={null}
{
  "success": false,
  "message": "Service temporarily unavailable. Please try again in a moment.",
  "error": "Database connection pool exhausted"
}
```
