文件

音訊來源分離(Beta)

Service: https://arts.api.yating.tw/v1
用此服務將音檔中的語者與背景聲音分離,常用於 Youtube 影片,或是電視台影片。
你需要提供原始音檔網址給我們,等處理完成後你就可以從新連結下載處理後的音檔結果。如果您沒有可以用的雲端儲存服務來產出原始音檔網址,您可以使用我們的服務,請參考 4. 音檔上傳。

發起移除背景音樂請求

Request
URL: /sourceSeparations
Method: POST
Header
Name
Type
Info
*key
String
*Content-Type
String
Only “application/json”
Body
Name
Type
Info
*audioUri
string
僅支援
mp3 wav 這兩種檔案。
且只能是Mono/Stereo的Audio Channel。
此外,Url 中要需要附檔名。
*isWhole
boolean
true only.
{
"audioUri":"audio_url",
"isWhole":true
}
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 請求,如下所示,以檢查轉錄狀態的更新。
您必須重複 GET 請求,直到您的狀態為“完成”或“錯誤”。 一旦狀態鍵顯示為“已完成”,您就可以
進行下一步,取得音檔結果。
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"
      }
   ]
}

取得音檔結果

只要你的音檔狀態是 completed,你即可從以下 path 中取得處理後的音檔連結,並進行下載。
請注意,一但音檔完成後,因為安全問題,檔案只會保留 24 小時,超過就漚會自動刪除。
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"
}

音檔上傳(optional)

如果您沒有可以使用的雲端儲存空間可以放置您的音檔,你可以使用我們的雲端暫存服務,上傳成功後即可取得一組特殊檔案連結位址,這位址僅提供雅婷內部服務使用,所有外部服務皆無法開啟。請注意,因為安全性考量,檔案只會保留 24 小時,超過後自動刪除。
Request
URL: /uploads
Method: POST
以下是 cURL 範例。
curl --location --request POST 'https://arts.api.yating.tw/v1/uploads' \
--header 'Key: Your_Key' \
--form 'file=@"your_audio_file_Path"'
以下是Python 範例。
import requests
filename = "Your_audio_file_path"

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

print(response.json())

限制

每個key的最大同時需求處理數:1