> ## Documentation Index
> Fetch the complete documentation index at: https://developer.audioshake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Music Detection

> Identify where music appears in long-form audio and video content

Find every music segment in a podcast, video, or broadcast — with start and end timestamps. Use the results for licensing review, content indexing, or triggering downstream processing only where music is present.

## Create a Task

```python detect_music.py theme={null}
import requests

API_KEY = "your_api_key"
HEADERS = {"Content-Type": "application/json", "x-api-key": API_KEY}

response = requests.post(
    "https://api.audioshake.ai/tasks",
    headers=HEADERS,
    json={
        "assetId": "your_asset_id",
        "targets": [
            {"model": "music_detection", "formats": ["json"]}
        ]
    }
)

task_id = response.json()["id"]
print(f"Task created: {task_id}")
```

```javascript detectMusic.js theme={null}
const API_KEY = "your_api_key";
const headers = { "Content-Type": "application/json", "x-api-key": API_KEY };

const createRes = await fetch("https://api.audioshake.ai/tasks", {
  method: "POST",
  headers,
  body: JSON.stringify({
    assetId: "your_asset_id",
    targets: [
      { model: "music_detection", formats: ["json"] }
    ]
  })
});

const { id: taskId } = await createRes.json();
console.log(`Task created: ${taskId}`);
```

```bash curl theme={null}
curl -X POST "https://api.audioshake.ai/tasks" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $AUDIOSHAKE_API_KEY" \
  -d '{
    "assetId": "your_asset_id",
    "targets": [
      { "model": "music_detection", "formats": ["json"] }
    ]
  }'
```

[Check Task status](https://developer.audioshake.ai/check-task-status.md) to monitor progress and download results, or use [webhooks](https://developer.audioshake.ai/api-reference/tasks/webhooks.md) to be notified when each target completes.

## Output format

Music is detected in 10-second intervals. The output JSON contains an array of segments where music is present, each with a confidence score:

```json theme={null}
[
  {
    "start_time": 20.0,
    "end_time": 30.0,
    "confidence": 0.18
  },
  {
    "start_time": 40.0,
    "end_time": 60.0,
    "confidence": 0.32
  }
]
```

| Field | Description |
| - | - |
| `start_time` | Start of the music segment (seconds) |
| `end_time` | End of the music segment (seconds) |
| `confidence` | Detection confidence score (0–1) |

## Use cases

* Flag content that requires music licensing review
* Build searchable timelines of music usage across archives
* Trigger stem separation or transcription only on segments containing music
* Monitor broadcast compliance with music usage policies

> [card] [Dialogue Separation](https://developer.audioshake.ai/remove-dialogue-for-dubbing.md)
>
> Separate speech from music and effects in your content.

> [card] [Models](https://developer.audioshake.ai/models.md)
>
> See all available detection and analysis models.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.