Ready to begin? This tutorial will guide you through the essential steps to process files using the Music AI platform. In our demonstration, we will employ the stem isolation model to seamlessly separate vocals and accompaniment elements from a mixed audio track. The music-ai
namespace houses various workflows accessible to all users.
Creating a new job
Get ready to submit a job using a media file hosted at https://music.ai/demo.ogg
. Ensure that this URL is publicly accessible. If you lack a dedicated storage server or require a temporary public URL, consider leveraging our file upload service.
In this demonstration, we will utilize the music-ai/stems-vocals-accompaniment
template workflow
curl --request POST \
--url https://api.music.ai/api/job \
--header 'Authorization: your-api-key-here' \
--header 'Content-Type: application/json' \
--data '{
"name": "My job 123",
"workflow": "music-ai/stems-vocals-accompaniment",
"params": {
"inputUrl": "https://music.ai/demo.ogg"
}
}'
Notice that the server response contains the job id. This is the unique identifier for the job you just created!
{ "id": "27803abe-ec15-4f74-9e8a-18a99627e9b0" }
Retrieving the job results
Since we now have a job id, we can check its the results:
curl --request GET \
--url https://api.music.ai/api/job/27803abe-ec15-4f74-9e8a-18a99627e9b0 \
--header 'Authorization: your-api-key-here'
You should notice the server response is telling us that our job has started, but not completed. Lets wait 10 seconds and then check the status again:
{
"id": "27803abe-ec15-4f74-9e8a-18a99627e9b0",
"name": "My job 123",
"status": "SUCCEEDED",
"workflow": {
"id": "moises/stems-vocals-accompaniment",
"description": "Stems Isolations - Vocals & accompaniments"
},
"workflowParams": {
"inputUrl": "https://your-server.com/audio-input.m4a"
},
"result": {
"vocals": "https://cdn.music.ai/something/vocals.wav",
"accompaniments": "https://cdn.music.ai/something/accompaniments.wav"
},
"createdAt": "2022-12-07T19:21:42.170Z",
"startedAt": "2022-12-07T19:21:42.307Z",
"completedAt": "2022-12-07T19:22:00.325Z"
}
This time the job has completed, and we can access our results!
Delete job
Once you have retrieved the results, you can delete the job:
curl --request DELETE \
--url https://api.music.ai/api/job/27803abe-ec15-4f74-9e8a-18a99627e9b0 \
--header 'Authorization: your-api-key-here'