Search By Track Upload
In this scenario, you can find tracks matching another track by uploading it to our servers.
Uploading A Track
Most Sonic Searches are initiated from a track upload. You can initiate this upload however you like; all we care about is the POST endpoint. We even support
Access-Control-Allow-Origin: * for XHR form uploads, if you’d like to support drag and drop or file progress on newer browsers.
Unlike other API calls, which are made to your own installation of SourceAudio, uploads must go to
import.sourceaudio.com. Then you just post your file under the name file and our system will save it given the
id you provided. Your
id should not contain any special characters
[_a-zA-Z0-9\-] and should be as unique as possible so it doesn’t conflict with other uploads from your site. Internally, we just do a timestamp plus a random string. You will most likely find success in a similar approach. The
id will be valid for hours, but it is assumed you will use it immediately, and we cannot guarantee its longevity.
POST - http://import.sourceaudio.com/index.php
This request will return when the upload is complete.
|token||yes||Your authentication token|
|file||yes||Your file, submitted as form-data|
|id||no||The ID described above which allows you to specify a unique ID for subsequent requests.|
Processing An Upload
After your upload is complete, you must trigger the SonicSearch process. Depending on track length, this can take up to 20-30 seconds. Just pass in your
format (mp3, aiff, etc) from the upload, and it’ll give you back a
|format||yes||The format in which you uploaded the track which you would like to use for processing.|
|id||no||The ID you used to upload the track|
|name||no||The filename of the track you uploaded and would like to process|
Now that you have a
search_id, you can retrieve your matches. Matches are generated at the time of the request, not the time of the generated search. This means that if you want to save a popular
search_id for use later, the matches will update with additional tracks as they are added to your library.