Create Unique Vocal Tracks with Musicgen Newjeans

In the world of music production, the ability to generate high-quality tracks quickly and efficiently is invaluable. The Musicgen Newjeans Vocals service offers developers an innovative way to create music tracks with vocals, utilizing a model fine-tuned on the distinctive sound of NewJeans. This powerful tool simplifies the music creation process, allowing for rapid prototyping and experimentation with different styles and genres. With the capability to generate unique vocal tracks, developers can enhance their projects, whether for games, apps, or other multimedia experiences.
Prerequisites
To get started with Musicgen Newjeans Vocals, you will need a Cognitive Actions API key and a basic understanding of making API calls.
Generate Music with Vocals using MusicGen
This action allows you to create music tracks complete with vocals by leveraging the MusicGen model. By fine-tuning on songs by NewJeans, the model produces engaging and relevant vocal performances, although it may occasionally introduce glitchy vocal artifacts.
Input Requirements
To utilize this action, you need to provide the following inputs:
- Prompt: A text description of the music you wish to generate, including genre, artist, and tempo (e.g., "deep techno, NewJeans, 132 bpm").
- Duration: Specify the length of the audio in seconds (default is 8 seconds).
- Input Audio: A URI to an audio file that can act as a reference for the generated music.
- Continuation: A boolean indicating if the generated music should extend from the provided audio.
- Seed, Top K, Top P, Temperature: Parameters to control the randomness and diversity of the generated output.
Expected Output
The output will be a link to the generated audio file in the specified format (e.g., wav or mp3), allowing you to easily integrate it into your projects.
Use Cases for this specific action
- Music Production: Quickly generate unique tracks for original compositions or remixes, saving time and resources in the creative process.
- Game Development: Create atmospheric background music that adapts to the gameplay experience, enhancing player immersion.
- Advertising: Produce catchy jingles or promotional soundtracks tailored to brand messaging.
- Content Creation: Generate audio content for videos, podcasts, or social media, making your projects stand out with unique musical elements.
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 = "2af9216d-9c33-43ad-91d0-f5808211bbcd" # Action ID for: Generate Music with Vocals using MusicGen
# 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": "deep techno, NewJeans, 132 bpm",
"duration": 30,
"temperature": 1,
"continuation": false,
"audioOutputFormat": "wav",
"continuationStart": 0,
"multiBandDiffusion": false,
"inputInfluenceControl": 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
The Musicgen Newjeans Vocals service unlocks a new realm of possibilities for developers in music creation. By automating the generation of vocal tracks, it streamlines the process and allows for greater creative freedom. Whether you're developing a game, producing a film, or creating content for social media, this tool can significantly enhance your projects. Explore the potential of Musicgen Newjeans Vocals and take your audio creations to the next level!