# audio.mark_beats

> Writes markers on a music item at the beats of its audio.

Source: https://stuarty.com/docs/mcp/tools/edit/audio.mark_beats/

Places a marker at each beat of the visible part of the item, or at every nth beat, so that cuts and transitions can be aligned to the music. Beats are frames of the asset and come from the beat grid of the asset, supplied by the service in resolved; the command never starts a job. Markers have no effect on the picture or the sound. When the analysis finds no steady pulse, give bpm (and offset, the time of the first beat on the asset's own time axis, default 0) and the beats are those of that tempo; the grid of the asset is then not used, for example \{"item_id": "itm_s6t7v8w9x0", "bpm": 120, "offset": "0.25s"\}.

## Arguments

| Argument | Type | Required | Notes |
| --- | --- | --- | --- |
| `bpm` | `number` | no | Manual tempo in beats per minute, 20 to 400, for music whose pulse the analysis cannot find; replaces the detected grid.; min 20; max 400 |
| `every` | `integer` | no | Mark every nth beat of the visible part, from the first; default 1.; min 1; max 64 |
| `item_id` | `string` | yes | An audio item of an audio asset, or of a video asset with audio.; pattern `^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$` |
| `label` | `string` | no | Label of every marker, up to 60 characters; default none.; max length 60 |
| `offset` | `string` | no | With bpm: the time of the first beat on the asset's time axis, from its start; default "0s". |
| `replace` | `boolean` | no | True (default) replaces the item's markers; false keeps them and adds the beats. |

## Errors

- [`E_VALIDATION`](/docs/reference/error-codes#e_validation)
- [`E_NOT_FOUND`](/docs/reference/error-codes#e_not_found)
- [`E_TYPE_MISMATCH`](/docs/reference/error-codes#e_type_mismatch)
- [`E_INVALID_STATE`](/docs/reference/error-codes#e_invalid_state)
- [`E_LIMIT`](/docs/reference/error-codes#e_limit)

## Scope

Scope `edit`. The scope is the one an API key needs in network mode. Run `stuarty command:help audio.mark_beats` for the same description from the binary, or call the [`command_help`](/docs/mcp/tools/command_help) tool.

## Next steps

- [The edit tool](/docs/mcp/tools/edit)
- [Batches, revisions and idempotency](/docs/agents/batches)

**As an MCP call**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "edit",
    "arguments": {
      "project_id": "prj_7k2m9x4q1b",
      "base_revision": 12,
      "operations": [
        {
          "op": "audio.mark_beats",
          "args": {
            "every": 2,
            "item_id": "itm_s6t7v8w9x0",
            "label": "beat"
          }
        }
      ]
    }
  }
}
```

**As a batch file for the CLI**

```json
[
  {
    "op": "audio.mark_beats",
    "args": {
      "every": 2,
      "item_id": "itm_s6t7v8w9x0",
      "label": "beat"
    }
  }
]
```

```bash
stuarty edit --project prj_7k2m9x4q1b --ops batch.json --json
```

**Over HTTP**

```bash
curl -X POST "http://127.0.0.1:7878/api/v1/projects/prj_7k2m9x4q1b/edit" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "base_revision": 12,
  "operations": [
    {
      "op": "audio.mark_beats",
      "args": {
        "every": 2,
        "item_id": "itm_s6t7v8w9x0",
        "label": "beat"
      }
    }
  ]
}'
```

The ids in the example are illustrative: read the real ones with `project_get`.
