# Meta SAM Audio Span Separate API

> SAM Audio by Meta isolates a sound using time spans that mark where it occurs, optionally guided by a text description. It returns the isolated target and the residual audio, either full length or trimmed to the spans.

Source: https://www.sandbase.ai/models/meta/sam-audio/span-separate
API reference: https://www.sandbase.ai/models/meta/sam-audio/span-separate#api

## Facts

- Provider: Meta
- Type: Audio model
- Model ID: `meta/sam-audio/span-separate`
- Price: From $0.05 per run
- Capabilities: audio to audio
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

- Unified Run API: `POST https://api.sandbase.ai/v1/run`

```bash
curl -X POST https://api.sandbase.ai/v1/run \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "meta/sam-audio/span-separate",
  "audio": "https://v3b.fal.media/files/b/0a8853d1/T7zRmsiculA6u_V6RCF2c_man.mp3",
  "spans": [
    [
      {
        "end": 10,
        "start": 6,
        "include": true
      }
    ]
  ],
  "prompt": "man singing",
  "trim_to_span": false,
  "output_format": "wav",
  "reranking_candidates": 1,
  "use_sound_activity_ranking": false
}'
```

The response returns a run id; poll `GET https://api.sandbase.ai/v1/run/{id}` until the status is `completed` or `failed`.

## FAQ

### How do I call Meta SAM Audio Span Separate through SandBase?

Create a SandBase API key, then send requests with the model ID "meta/sam-audio/span-separate" to Unified Run API (/v1/run) at https://api.sandbase.ai. The request examples on this page show the exact payload.

### Do I need a separate Meta account?

No. One SandBase API key and balance gives you access to Meta SAM Audio Span Separate and the other models in the catalog; you do not need to sign up with Meta separately.

## README

### SAM Audio Span Separate

SAM Audio isolates a sound from the time spans where it occurs, with an optional text hint, and returns it with the residual track.

#### Fields

| Field | Type | Default | Notes |
|---|---|---|---|
| `audio` | audio file or URL, required | — | Recording to separate. |
| `spans` | array of `{start, end, include}`, required | — | Time ranges in seconds; `include: false` marks ranges to exclude. |
| `prompt` | string | — | Optional hint about the sound. |
| `trim_to_span` | boolean | false | Return only the span range instead of the full length. |
| `use_sound_activity_ranking` | boolean | false | Rank candidates by match to the spans; needs more than one candidate. |
| `reranking_candidates` | integer 1–7 | 1 | Extra candidates improve quality; each adds $0.025 per 30 s. |
| `output_format` | `wav` / `mp3` | `wav` | Output file format. |

#### Output

| Field | Notes |
|---|---|
| `url` | Isolated target sound. |
| `residual_url` | Everything else (the input minus the target). |
| `duration` | Output length in seconds. |

#### Billing

$0.05 per started 30 seconds of output audio (shorter with `trim_to_span`), plus $0.025 per 30 seconds for each extra reranking candidate. The final charge uses the measured output length; the quote uses the input length (10 minutes if it cannot be read).

| Audio | Price |
|---|---|
| 30 s, 1 candidate | $0.05 |
| 2 min, 1 candidate | $0.20 |
| 2 min, 3 candidates | $0.40 |

Failed runs are not charged.

#### Prompting

- Mark a span where the target is clearly audible; add a short prompt such as `dog barking` for better results.

#### Also on SandBase

Related: `meta/sam-audio/separate`, `meta/sam-audio/visual-separate`.
