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

# Extract sections and separate stems

> Choose between slicing a recording and separating its instruments.

Use the client from [request setup](/dev/guides/connect). These examples assume `api`, `userAddress`, and the returned `songId` are available. `api` includes the session token and selected account headers.

## Extract a time range

```javascript theme={null}
const extracted = await api.post('/api/editing/extract', {
  songId, start: 15, end: 30,
});
const take = extracted.take;
```

The response is ready immediately with an inactive take. `start` and `end` are seconds on the selected source. Pass `stemId` to slice a particular stem. This does not bounce your live arrangement or effects.

The extracted file begins at its own time zero; its provenance records where it belongs on the song timeline. Use [candidate merge](/dev/guides/edit/merge) to place it correctly.

## Separate instruments

```javascript theme={null}
const job = await api.post('/api/editing/separate', {
  songId, userAddress, stemType: 'all',
});
```

Choose a stem ID from `/api/options`, such as `vocals`, `drums`, `bass`, `other` or `instrumental`. Even though submission returns HTTP 200, the body can say `pending` or `processing`.

Use the polling function from [job handling](/dev/guides/jobs#generation-polling).

```javascript theme={null}
// Save job before polling so your product can resume after a reload.
const path = `/api/editing/status/${encodeURIComponent(job.taskId)}?` +
  new URLSearchParams({
    songId: job.songId, userAddress, task: job.task,
    ...(job.stemId ? { stemId: job.stemId } : {}),
  });
const result = await pollJob(() => api.get(path));
```

Keep the returned `taskId`, `songId`, `task`, and optional `stemId`. A polling timeout stops your client from waiting; it does not cancel the job.

On ready, use `result.stems`. Separation creates active takes for the returned tracks, with those stems initially muted. Reload the project. Your player can mute Master and unmute selected stems to audition them without doubling the same recording.

```javascript theme={null}
await api.patch(`/api/editing/mixer/${encodeURIComponent(stem.id)}`, {
  is_muted: false,
});
```

`stem` is one returned stem selected by your user. Mixer persistence does not render a new audio file.


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