API Requests & Responses :
This document shows the workflow of the Separation API and examples of requests/responses of each endpoint.
Overview:
The main process of a separation is as follows:
Other optional features of the separation api are:
Header:
Content-Type: application/json
Request payload:
{"username":"demixr.com","password":"r0s4nn4"}
Response:
{
"token": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w",
"expiry": 86400,
"token_type": "Bearer "
}
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Response:
{
"uploadId": "5f0c5fbab669c67bbbd1e2eb",
"signedUrl": "https://storage.googleapis.com/staging-separations/demixr.com/4c55425e-b3f0-4fcc-bcae-29cc13919614/request/requestData?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=api2-service-account%40staging-api-255516.iam.gserviceaccount.com%2F20200713%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20200713T132058Z&X-Goog-Expires=86400&X-Goog-SignedHeaders=host&X-Goog-Signature=65ff2f0e6cbbbdf85519ec2b747fc9b4b19bbc9dde42ae60fc906e5d06a9142d6ce3e6ffd6e63c2302d9861f545d3e936a4c3235f8ab9b5e6325c356b681ecb2caae1e76e9e0fa7ffa42ee60798a7fce8b989797d3afbf843279ce876289508a2c563b89487cbf290e1bfe0f672325c2fd8aeefc743804c3d6fd9bc4ca579de733c8d0c94b2efd124873f2d5b39aaa2cda95b9cce4c56a01db707ee3884ad0d6c705363e4560656c972cb02b1f43720afb3ad88f03ee2d613b6ef3bc06b5a31e0beab1c41a98a669648b3f64e14ce2a8531b362da8ddd5206ae96523a369adfe30a2f496b848a8fdd98bd5865b064ffbbc91bbec78fb2eb5a8cba18b88e4482d",
"expiry": "2020-07-14T13:20:58.140",
"method": "PUT"
}
Headers:
Content-Type: text/plain
Request payload:
The binary file to upload for separation (any supported audio format: wav, mp3, m4a, flac...)
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Response:
HttpStatus 202 (at first, while metadata is being calculated)
HttpStatus 200 (once metadata is ready, after just a few seconds)
{
"duration": 33.827868, (in seconds)
"numChannels": 2,
"sampleRate": 44100,
"message": "completed",
"success": true
}
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Request payload:
{
"uploadId": "5f0c5fbab669c67bbbd1e2eb",
“separationAlgorithm”:6 (6 = vocal-accompaniment, 7 = 4-stem),
“customMetadata” : “bless the rains”,
“callbackUrl” : “example-url.com”
}
Response:
200 OK
{
"separationId": "5f0c60f3b669c67bbbd1e2ee"
}
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Request payload:
{
"uploadId": "5f0c5fbab669c67bbbd1e2eb",
“separationAlgorithm”:6, (6 = vocal-accompaniment, 7 = 4-stem)
"trialSectionSeconds":50.6, (in seconds, defaults to 30)
“trialSectionStart”:10.2 (in seconds, if not specified a random value is used),
“customMetadata” : “bless the rains”,
“callbackUrl” : “example-url.com”
}
Response:
200 OK
{
"separationId": "5f0c60f3b669c67bbbd1e2ee"
}
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Request parameters:
separationId=5f0c60f3b669c67bbbd1e2ee
Response:
List of events that will be updated throughout the separation:
During separation: | Separation finished: |
{ "events": [ { "event": "Formatting Request File", "guid": "de7ba252-3139-4eab-9dec-07d826e416bb", "timestamp": "2020-07-21T14:50:57.396Z", "message": "Formatting requestData into wav" }, { "event": "Request Formatting Done", "guid": "d05602f0-36c4-42d2-8c6d-4fe9aaeec59f", "timestamp": "2020-07-21T14:51:05.458Z", "message": "" }, { "event": "Requesting Metadata", "guid": "78e690ec-d48a-45c7-8ff7-c1f39f66b9b6", "timestamp": "2020-07-21T14:51:05.478Z", "message": "Requesting metadata from server" }, { "event": "Metadata Task Done", "guid": "7c67c326-4983-4c32-81e8-0a231ff90d2f", "timestamp": "2020-07-21T14:51:05.484Z", "message": "" }, { "event": "Trial Chunking Start", "guid": "5f4fd7f3-2443-4b31-ad84-7c273ab2b2fc", "timestamp": "2020-07-21T14:51:05.513Z", "message": "" }, { "event": "Trial Chunking Done", "guid": "d5eb44c5-64cf-4067-88f2-c1a1acdff93c", "timestamp": "2020-07-21T14:51:11.922Z", "message": "" }, { "event": "Starting Separation", "guid": "9f984b6c-285c-4732-b61a-c8f5a8be3ce0", "timestamp": "2020-07-21T14:51:11.950Z", "message": "Starting Separation process" }, { "event": "Queue message received", "guid": "51510fe0-8a97-41fb-b213-b548f4b3c982", "timestamp": "2020-07-21T14:51:15.176Z", "message": "Attempt number 1" }, { "event": "Processing", "guid": "b30f2f98-df30-460e-984c-f5c5f63f7dd7", "timestamp": "2020-07-21T14:51:15.846Z", "message": null } ], "outputFiles": null } | { "events": [ { "event": "Formatting Request File", "guid": "de7ba252-3139-4eab-9dec-07d826e416bb", "timestamp": "2020-07-21T14:50:57.396Z", "message": "Formatting requestData into wav" }, { "event": "Request Formatting Done", "guid": "d05602f0-36c4-42d2-8c6d-4fe9aaeec59f", "timestamp": "2020-07-21T14:51:05.458Z", "message": "" }, { "event": "Requesting Metadata", "guid": "78e690ec-d48a-45c7-8ff7-c1f39f66b9b6", "timestamp": "2020-07-21T14:51:05.478Z", "message": "Requesting metadata from server" }, { "event": "Metadata Task Done", "guid": "7c67c326-4983-4c32-81e8-0a231ff90d2f", "timestamp": "2020-07-21T14:51:05.484Z", "message": "" }, { "event": "Trial Chunking Start", "guid": "5f4fd7f3-2443-4b31-ad84-7c273ab2b2fc", "timestamp": "2020-07-21T14:51:05.513Z", "message": "" }, { "event": "Trial Chunking Done", "guid": "d5eb44c5-64cf-4067-88f2-c1a1acdff93c", "timestamp": "2020-07-21T14:51:11.922Z", "message": "" }, { "event": "Starting Separation", "guid": "9f984b6c-285c-4732-b61a-c8f5a8be3ce0", "timestamp": "2020-07-21T14:51:11.950Z", "message": "Starting Separation process" }, { "event": "Queue message received", "guid": "51510fe0-8a97-41fb-b213-b548f4b3c982", "timestamp": "2020-07-21T14:51:15.176Z", "message": "Attempt number 1" }, { "event": "Processing", "guid": "b30f2f98-df30-460e-984c-f5c5f63f7dd7", "timestamp": "2020-07-21T14:51:15.846Z", "message": null }, { "event": "Finalising", "guid": "85164348-d805-4c42-9faa-894d4f708362", "timestamp": "2020-07-21T14:52:06.007Z", "message": null } ], "outputFiles": [ "track.wav", "vocals.wav" ] } |
The separation is finished when “outputFiles” is not empty. The last event (“Finalising”) means that the separated files are being uploaded, so there can still be a few seconds before “outputFiles” is filled.
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Request parameters:
separationId=5f0c60f3b669c67bbbd1e2ee
fileName=vocals (the extension must be removed)
fileFormat=wav (could also be written .wav, either way is fine)
NB: the file formats allowed are mp3,m4a,wav,flac
Response:
The signed url to download the response file (to give the customer or to download on your web server). This link will expire after a while but you can request a new one from the download endpoint before that happens
{
"signedUrl": "https://storage.googleapis.com/staging-separations/demixr/2020-07-08T15-03-22-92-92/response/vocals.wav?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=api2-service-account%40staging-api-255516.iam.gserviceaccount.com%2F20200708%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20200708T152732Z&X-Goog-Expires=86400&X-Goog-SignedHeaders=host&X-Goog-Signature=d18efb1a0ccc1fbfe078f09cc727207ed3d8a7225cf325bbe0a8ed482807dd1ac07eaba5d8f353ee7956f925685a30ec38454e2f317480ca9ab358ae8d8777b4003ca0728d3112cc4986a6066583394bb797323c735ed9c0a9c756e1b977958bd2059e03f9e3e9d480868e1d5f6b39945099004e588151fc7b175e370032b8f8723b6ff9de544750371d08c0639de41b3106573bd726ac4d7ce751a897574e30c4659924487771091fd0548d2a04bdd58895fc013fb59b90bdcf1a6aaa3118a882b5c6138b137c8431f1740d2b091f608a0bf1e570452919e60915e01c49353253e038bd44063b9d7e6ebcc9b3bb4a5cee536187c4a08fe2d644b87d77e9af99",
"expiry": "2020-07-09T15:27:32.723",
"method": "GET"
}
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Request payload:
{
"tracks": [
{
"fileName": "track.wav", (use the names you got back from progress endpoint)
"volume": 0.61, (value between 0 and 1)
"pan": -1 (value between -1: full left, to 1: full right)
},
{
"fileName": "vocals.wav",
"volume": 0.90,
"pan": 1
}
],
"separationId": "5f15c73bb31d945f389583af"
"mixName": "my mix" (no extension, this will create the mix but the files will be downloaded with the download endpoint)
}
Response:
The path of the mix file to request for download
{
"mixId": "mix/mix_a3beaff9-17f2-4eb7-81bb-87d4737214eb"
}
The mix will be downloaded just like any other file, by calling the download endpoint as follows:
https://api2.staging.sourceresoftware.com/separation/download?separationId=5f15c73bb31d945f389583af&fileName=mix/mix_2b47faa9-4b11-49c6-b646-595ce039062b&fileFormat=mp3
This will return http status 202 until the file is ready at which point http status 200 and a json response containing the signed url to download will be provided.
Headers:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkZW1peHIuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTU5NDExMTQ4OSwiZXhwIjoxNTk0MTk3ODg5fQ.UTwZtVawBflpIDK5H8l4_raX6iT-eEl21cDUGTWGm0jN6MdlBOxZCuRf0DL5rxl5XNrV1aPWgi5MJo7wd8Uu3w
Content-Type: application/json
Request payload:
{
"separationId":"5f212898dbe5b2724453e8c2",
"tracks":["bass","other","drums","vocals"],
"format":"mp3",
"zipFileName": "myzipfile" (name of the file without .zip)
}
Response:
The path of the zip file to request for download
{
"zipFilePath": "zip/525a7195-9cca-4de0-9da0-65fec2d0798b.zip"
}
The zip will be downloaded just like any other file, by calling the download endpoint as follows:
https://api2.staging.sourceresoftware.com/separation/download?separationId=5f15c73bb31d945f389583af&fileName=zip/525a7195-9cca-4de0-9da0-65fec2d0798b.zip&fileFormat=zip
NB: keep the “.zip” part of “zipFilePath”, but also specify fileFormat=zip when calling the download endpoint
This will return http status 202 until the file is ready at which point http status 200 and a json response containing the signed url to download will be provided.