Documentations

Audio source separation(Beta)

Service: https://arts.api.yating.tw/v1
You can use it to remove background music, including instruments and vocals. Make sure you upload the audio file to a cloud storage service before making a request.
After processing, you’ll get a new audio file uri.If your audio files aren't accessible via a URL already (like in an S3 bucket, static file server, or via an API like Twilio), you can upload your files directly to the Yating, please see 4. Upload audio file.

Make a source separation request

Request
URL: /sourceSeparations
Method: POST
Header
Name
Type
Info
*key
String
*Content-Type
String
Only “application/json”
Body
Name
Type
Info
*audioUri
string
Only
mp3, wav, mp4 and mov.
{
  "audioUri":"audio_url",
}
Response
[
   {
       "uid": "313fb766-cf44-421c-b818-6127ed91d739",
       "audioUri": "your_autio_url",
       "status": "pending",
       "createdAt": "2022-08-26T11:40:42.401Z",
       "updatedAt": "2022-08-26T11:40:42.401Z"
   }
]

Get status

After you submit audio files for processing, the "status" key will go from "pending" to "ongoing" and finally to "completed". If something goes wrong, it goes to "error". You can make a GET request, as shown below, to check for updates on the status.
You'll have to make repeated GET requests until your status is "completed" or "error". Once the status key is shown as "completed", you can get a new audio uri in step3.
Request
URL: /sourceSeparations?page=1&perPage=10&status=pending
Method: GET
Header
Name
Type
Info
*key
String
Bearer {key}
Query parameter
Name
Info
page
number
perPage
number
status
pending, ongoing, completed, error. if no value, get all list
Response
{
   "page":1,
   "perPage":10,
   "total":1,
   "nextPage":null,
   "data":[
      {
         "uid":"75911e73-4d3d-4104-a3e5-6ed4f7966b7a",
         "path":{
            "speech":"",
            "ambience":""
         },
         "status":"ongoing",
         "createdAt":"2022-08-04T18:02:38.093Z",
         "updatedAt":"2022-08-04T18:02:38.093Z"
      }
   ]
}

Get new audio uri

Once the status key is shown as "completed", you are able to query the new audio uri in path. These results will be preserved up to 24 hours after the competition.
Request
URL: /sourceSeparations/{source_separation_id}
Method: GET
Header
Name
Type
Info
*key
String
Bearer {key}
Query parameter
Name
Info
source_separation_id
string, uid.
Response
{
   "uid":"ae494c3a-02da-4272-b6dc-6ea6fa83cd81",
   "audioUri":"your_audio_url",
   "path":{
      "speech":"resutl_url",
      "ambience":"resutl_url"
   },
   "taskId":"35eca27c-cdaa-45a4-8ad5-9236879223b1",
   "status":"completed",
   "createdAt":"2022-10-13T09:58:06.609Z",
   "updatedAt":"2022-10-13T09:58:26.000Z"
}

Upload audio file

Once your upload finishes, you'll get back a JSON response that includes an url. The url points to a private URL, accessible only to Yating backend servers. The file url will be preserved up to 24 hours after being uploaded.
Request
URL: /uploads
Method: POST
cURL sample
curl --location --request POST 'https://arts.api.yating.tw/v1/uploads' \
--header 'Key: Your_Key' \
--form 'file=@"your_audio_file_Path"'
Python sample
import requests
filename = "Your_audio_file_path"

headers = {'key': "Your_key"}
files = {'file': open(filename,'rb')}
response = requests.post('https://arts.api.yating.tw/v1/uploads',
                        headers=headers,
                        files=files)

print(response.json())

Limits

Max concurrent requests per key:1