Skip to main content

Music Detection

The music_detection model identifies segments within an audio file that contain music. Music is detected in 10 second intervals and the response is provided in JSON format:

[
{
"start_time": 20.0,
"end_time": 30.0,
"confidence": 0.17867346107959747
},
{
"start_time": 40.0,
"end_time": 60.0,
"confidence": 0.3173922598361969
}
]
ElementDescription
start_timeThe time (in seconds) when music begins.
end_timeThe time (in seconds) when music ends.
confidenceConfidence level that music is present (0 to 1 scale).
Confidence

Confidence values closer to 1 indicate higher certainty that music is present. Even low values (e.g., 0.1 or less) generally mean high accuracy. Any returned segment is likely to contain music.

Step-by-Step Usage

1. Upload Audio File

First, upload your audio file to obtain an asset ID required for the job request.

Detailed instructions: File Upload Documentation

2. Create a Music Detection Job

After uploading a file and obtaining the asset ID, you can submit a job for music_detection:

curl -X 'POST' \
'https://groovy.audioshake.ai/job/' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"metadata": {
"format": "json",
"name": "music_detection"
},
"assetId": "abc123"
}'
InputDescription
formatOutput file format. Supported formats here.
nameModel name; always music_detection for this use-case.
assetIdAsset ID obtained after uploading your file.
callbackUrlOptional webhook URL for job status notifications.

You'll recieve a response like:

{
job: {
id: "<job ID>",
clientId: "<YOUR CLIENT ID>",
requestId: "<request ID>",
metadata: {
format: "json",
name: "music_detection"
},
assetId: "abc123"
},
}

3. Check Job Status

Using the given id from the job creation response, check the status of your job:

curl -X 'GET' \
'https://groovy.audioshake.ai/job/<id>' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'

Once the status of the job is complete, the response will include a downloadable link to your JSON output.

More details about job handling can be found here.

Supported audio input formats are documented here.