Create Unique Music Extensions with Soad Music Gen

Introduction
Soad Music Gen offers an innovative way for developers to generate music continuations in the unique style of System of a Down. Utilizing the fine-tuned COMPP FS24 model based on MusicGen, this service allows you to extend existing audio files with new compositions. Whether you're looking to add depth to a project, create unique soundtracks, or simply experiment with music generation, Soad Music Gen simplifies the process, making it accessible and efficient.
Imagine having the ability to take an existing track and seamlessly add new segments that match the distinctive sound you love. This service is perfect for content creators, game developers, and musicians who want to infuse their work with fresh, original music while maintaining a familiar vibe.
Prerequisites
To get started with Soad Music Gen, you will need a Cognitive Actions API key and a basic understanding of how to make API calls.
Cognitive Actions Overview
Generate Music Continuation in Style of System of a Down
This action allows developers to generate music continuations that resonate with the iconic sound of System of a Down. By leveraging advanced AI models, you can produce compositions that feel both original and familiar, solving the challenge of creating cohesive music extensions.
Input Requirements
The input for this action requires a structured object that includes:
- seed: An integer for random number generation (optional).
- topK: Limits the sampling to the top K most likely tokens (default is 250).
- topP: Limits sampling to tokens with a cumulative probability of P (default is 0).
- prompt: A textual description of the music style to be generated (e.g., "grungy, rock, starting with guitar intro").
- duration: The length of the generated audio in seconds (default is 8).
- inputAudio: A URI to an audio file that influences the generated music.
- temperature: A number regulating the randomness of the output (default is 1).
- continuation: A boolean indicating whether to extend an existing melody or mimic it (default is false).
- continuationEnd: The end time for using the audio file in continuation (defaults to the end if set to -1).
- continuationStart: The start time for using the audio file in continuation (default is 0).
- outputAudioFormat: The desired format of the generated audio file (options are 'wav' or 'mp3', default is 'wav').
- Additional parameters for audio normalization strategy and diffusion settings.
Expected Output
The output will be a URI linking to the generated audio file, allowing you to easily access and utilize the new composition.
Use Cases for this specific action
- Content Creation: Enhance videos, podcasts, or streams with unique music continuations that fit a specific theme.
- Game Development: Create immersive soundscapes by extending existing game soundtracks with AI-generated music that matches the game's atmosphere.
- Music Production: Experiment with new ideas by generating variations of your tracks, helping to spark creativity and innovation in your music projects.
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "4443ebd3-37ca-45c0-a75a-dee0cd377f60" # Action ID for: Generate Music Continuation in Style of System of a Down
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"topK": 250,
"topP": 0,
"prompt": "grungy, rock, starting with guitar intro, going into minor chords with heavy drop",
"duration": 40,
"inputAudio": "https://replicate.delivery/pbxt/KztcP5VBZCDHRp21D2ImXtZ2WGpMsME9Z7ExndkgJlzp7fPo/1_Internet%20Drama_%28Instrumental%29.wav",
"temperature": 1,
"continuation": true,
"continuationEnd": 8,
"continuationStart": 0,
"outputAudioFormat": "wav",
"multiBandDiffusion": true,
"classifierFreeGuidance": 3,
"audioNormalizationStrategy": "loudness"
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
print(json.dumps(result, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error executing action {action_id}: {e}")
if e.response is not None:
print(f"Response status: {e.response.status_code}")
try:
print(f"Response body: {e.response.json()}")
except json.JSONDecodeError:
print(f"Response body (non-JSON): {e.response.text}")
print("------------------------------------------------")
Conclusion
Soad Music Gen empowers developers to create original music continuations effortlessly, allowing for enhanced creativity and innovation in various projects. With its customizable parameters, this service is perfect for anyone looking to add a unique musical touch to their content. Begin your journey into music generation today and explore the endless possibilities that await!