Trim and Loop Audio - Music From Text Generation

This API allows you to Generate stunning AI-driven music from text prompts — then intelligently detects and creates a seamless loop that syncs perfectly with your creative vision.

Choose between:

  • 🎧 HD Qualitysansaar_1 (Higher fidelity)
  • Fast Modesansaar_1_lite (Quicker processing)

Core Parameters

🛈 The parameters below define the request body for this API.

ParameterTypeRequired?Description
promptstring✅ Required   Text description of the music.
durationint⚠️ Optional   Track length (15s, 30s, 60s, 180s).
modelstring⚠️ Optional  "sansaar_1" (HQ) or "sansaar_1_lite" (Faster).
loopbool⚠️ Optional   Whether the music should loop.
loopCountint✅ Required   Number of times the trimmed part should loop.

Request Example

{
  "prompt": "A futuristic electronic track with deep bass and synths.",
  "duration": 15,
  "model": "sansaar_1_lite",
  "loop": true,
  "loopCount": 3
}

Code Samples

  import requests

  url = "https://api.soundverse.ai/v1/trim-and-loop/gen-and-loop/music/auto/"
  headers = {
      "Authorization": "Bearer your_api_key_here",
      "Content-Type": "application/json"
  }
  payload = {
  "prompt": "string",
  "duration": "int",
  "model": "string",
  "loop": "bool",
  "loopCount": "int"
  }

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

Response

    {
    "prompt": looped_data.get("prompt"),
    "albumArt": looped_data.get("albumArt"),
    "aiReply": looped_data.get("aiReply"),
    "generatedAudio": [
        {
            "audioUrl": a.get("audioUrl"),
            "songName": a.get("songName"),
            "licenses": a.get("licenses")
        }
    ],
    "loopedAudio": [
        {
            "audioUrl": a.get("audioUrl"),
            "songName": a.get("songName"),
            "licenses": a.get("licenses")
        }
    ]
}

Sample Output

{
    "prompt": "hopeful melody with rising strings and ambient piano, like the end of a movie when the hero finds peace",
    "albumArt": "https://cdn.example.com/artworks/abc123.png",
    "aiReply": "Congratulations! Your audio file is now at your fingertips. Play it loud, play it proud!",
    "generatedAudio": [
        {
            "audioUrl": "https://storage.googleapis.com/x-one/682389b76cafe82ba0a20d77/682389b76cafe82ba0a20d77/xone20250602054641n60m527u.wav",
            "songName": "Tranquil Serenade: A Heros Respite",
            "licenses": null
        }
    ],
    "loopedAudio": [
        {
            "audioUrl": "https://storage.googleapis.com/x-one/682389b76cafe82ba0a20d77/682389b76cafe82ba0a20d77/looped/60e8c9ae-ec86-4efd-b0b4-45c4c8b3dcf9.wav",
            "songName": "Tranquil Triumph: A Heros Serene Resolution",
            "licenses": null
        }
    ]
}

Possible Errors :

  • If NSFW words are detected
{
  "success": False,
  "message": "NSFW words detected. Please try again with a different prompt.",
}
  • If Artist name is detected
{
  "success": False,
  "message": "Artist name detected. Please try again with a different prompt.",
}
  • If Length of provided audio is too short.
{
"success": False,
"message": "Not enough beats to create loop.",
}
  • If Length of looped audio is more than 960.
{
"success": False,
"message": "Maximum audio duration of 960 seconds reached.",
}

Trim and Loop Audio - Prompt Based Generation

This API allows you to feed in your prompt, get AI-powered audio — then automatically trim and loop the most seamless segment, perfectly aligned with your creative vision.


Core Parameters

The following parameters are required to send a valid request:

ParameterTypeRequired?Description
promptstring✅ RequiredText description of the music.
styleOfMusicstring✅ RequiredPreferred style. Select one from supported styles listed below.
audioUrlstring⚠️ OptionalURL to a reference audio file for influence.
loopCountint✅ RequiredNumber of times to loop the detected seamless segment.

Request Example

{
  "prompt": "A hopeful ambient piano loop that feels cinematic",
  "styleOfMusic": "Ambient",
  "audioUrl": "https://example.com/audio.wav",
  "loopCount": 4
}

Code Samples

  import requests

  url = "https://api.soundverse.ai/v1/trim-and-loop/gen-and-loop/song/prompt/auto"
  headers = {
      "Authorization": "Bearer your_api_key_here",
      "Content-Type": "application/json"
  }
  payload = {
    "prompt": "string",
    "styleOfMusic": "string",
    "audioUrl": "string",
    "loopCount": "int"
  }

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

Response

{
  "prompt": string,                
  "albumArt": string (URL) ,       
  "aiReply": string,              

  "generatedAudio": [              
      {
      "audioUrl": string (URL),    
      "songName": string
      }
  ],

  "loopedAudio": [                
      {
      "audioUrl": string (URL),    
      "songName": string
      }
  ]
}

Sample Output

{
  "prompt": "upbeat electronic tune with a futuristic vibe",
  "albumArt": "https://cdn.example.com/artworks/abc123.png",
  "aiReply": "Here's an upbeat electronic track matching your prompt.",
  "generatedAudio": [
    {
      "audioUrl": "https://cdn.example.com/audio/generated/xyz789.mp3",
      "songName": "Futuristic Pulse"
    }
  ],
  "loopedAudio": [
    {
      "audioUrl": "https://cdn.example.com/audio/looped/xyz789_looped.mp3",
      "songName": "Futuristic Pulse (Looped x3)"
    }
  ]
}

Possible Errors :

  • If Rate Limits have been passed for User.
{
"success": False,
"message": "Rate limits have been passed for the user.",
}
  • If NSFW words are detected
{
"success": False,
"message": "NSFW words detected. Please try again with a different prompt.",
}
  • If Artist name is detected
{
"success": False,
"message": "Artist name detected. Please try again with a different prompt.",
}
  • If Length of provided audio is too short.
{
"success": False,
"message": "Not enough beats to create loop.",
}
  • If Length of looped audio is more than 960.
{
"success": False,
"message": "Maximum audio duration of 960 seconds reached.",
}

Trim and Loop Audio - Lyrics Based Generation

This API allows you to feed in your lyrics, get AI-powered audio — then automatically trim and loop the most seamless segment, perfectly aligned with your creative vision.


Core Parameters

The following parameters are required to send a valid request:

ParameterTypeRequired?Description
lyricsstring✅ RequiredLyrics to be converted into a song.
styleOfMusicstring⚠️ Optional (Either styleOfMusic or audioUrl must be present)Preferred style. Select one from supported styles listed above.
audioUrlstring⚠️ Optional (Either styleOfMusic or audioUrl must be present)URL to a reference audio file for influence.
loopCountint✅ RequiredNumber of times to loop the detected seamless segment.

Request Example

{
  "lyrics": "A hopeful ambient piano loop that feels cinematic",
  "styleOfMusic": "Ambient",
  "audioUrl": "https://example.com/audio.wav",
  "loopCount": 4
}

Code Samples

  import requests

  url = "https://api.soundverse.ai/v1/trim-and-loop/gen-and-loop/song/lyrics/auto"
  headers = {
      "Authorization": "Bearer your_api_key_here",
      "Content-Type": "application/json"
  }
  payload = {
    "lyrics": "string",
    "styleOfMusic": "string",
    "audioUrl": "string",
    "loopCount": "int"
  }

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

Response

{
  "prompt": string,                
  "albumArt": string (URL) ,       
  "aiReply": string,              

  "generatedAudio": [              
      {
      "audioUrl": string (URL),    
      "songName": string
      }
  ],

  "loopedAudio": [                
      {
      "audioUrl": string (URL),    
      "songName": string
      }
  ]
}

Sample Output

{
  "prompt": "upbeat electronic tune with a futuristic vibe",
  "albumArt": "https://cdn.example.com/artworks/abc123.png",
  "aiReply": "Here's an upbeat electronic track matching your prompt.",
  "generatedAudio": [
    {
      "audioUrl": "https://cdn.example.com/audio/generated/xyz789.mp3",
      "songName": "Futuristic Pulse"
    }
  ],
  "loopedAudio": [
    {
      "audioUrl": "https://cdn.example.com/audio/looped/xyz789_looped.mp3",
      "songName": "Futuristic Pulse (Looped x3)"
    }
  ]
}

Possible Errors :

  • If Rate Limits have been passed for User.
{
"success": False,
"message": "Rate limits have been passed for the user.",
}
  • If NSFW words are detected
{
"success": False,
"message": "NSFW words detected. Please try again with a different prompt.",
}
  • If Artist name is detected
{
"success": False,
"message": "Artist name detected. Please try again with a different prompt.",
}
  • If Length of provided audio is too short.
{
"success": False,
"message": "Not enough beats to create loop.",
}
  • If Length of looped audio is more than 960.
{
"success": False,
"message": "Maximum audio duration of 960 seconds reached.",
}