> ## 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

<CodeGroup>
  ```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"] }
      ]
    }'
  ```
</CodeGroup>

[Check Task status](/check-task-status) to monitor progress and download results, or use [webhooks](/api-reference/tasks/webhooks) 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

<CardGroup cols={2}>
  <Card title="Dialogue Separation" icon="film" href="/remove-dialogue-for-dubbing">
    Separate speech from music and effects in your content.
  </Card>

  <Card title="Models" icon="grid-2" href="/models">
    See all available detection and analysis models.
  </Card>
</CardGroup>
