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

# Stems

> Stammtrennungsaufgaben in einem bestehenden Projekt auslösen

Stems sind die Gesangs- und Instrumentalspuren, die aus dem Quell-Audio extrahiert werden. Youka trennt Stems automatisch, wenn du ein Projekt erstellst, aber du kannst die Trennung jederzeit mit einem anderen Modell erneut ausführen.

## `client.projects.separateStems(projectId, body, options?)`

Startet eine neue Stammtrennungs-Operation für ein Projekt.

```ts theme={null}
const operation = await client.projects.separateStems("prj_abc123", {
  splitModel: "audioshakeai",
});

const { project } = await client.projects.wait(operation);
console.log(project.stems);
```

### Parameters

<ParamField path="projectId" type="string" required>
  Das Projekt, das erneut verarbeitet werden soll.
</ParamField>

<ParamField path="splitModel" type="SplitModel">
  Modell zur Stammtrennung. Siehe [Split model reference](/de/desktop/split-model)
  als Orientierungshilfe.
</ParamField>

### Available models

| Value                                         | Description                               |
| --------------------------------------------- | ----------------------------------------- |
| `mdx23c`                                      | Standard. Ausgewogene Qualität und Tempo. |
| `audioshakeai`                                | Hochwertige AudioShake-Trennung.          |
| `audioshake_vocals_lead`                      | Nur Vocals und Lead Vocals.               |
| `musicai_instrumental_only`                   | Ausgabe nur Instrumental.                 |
| `musicai_lead_backing_other`                  | Lead, Backing Vocals und andere Stems.    |
| `musicai_with_backing_vocals`                 | Vocals inklusive Backing-Tracks.          |
| `musicai_without_backing_vocals`              | Nur Lead Vocals.                          |
| `uvr_mdxnet_kara_2`                           | Karaoke-optimiertes UVR-Modell.           |
| `bs_roformer`                                 | BS-Roformer-Modell.                       |
| `mel_band_roformer_instrumental_becruily`     | Mel-Band Roformer Instrumental.           |
| `mel_band_roformer_instrumental_instv7_gabox` | Alternatives Mel-Band Instrumental.       |
| `demucs`                                      | Facebook Demucs.                          |

## End-to-end example

```ts theme={null}
import { YoukaClient, YoukaTaskError } from "@youka/de/sdk";

const client = new YoukaClient({ apiKey: process.env.YOUKA_API_KEY! });

async function reRunStems(projectId: string) {
  const operation = await client.projects.separateStems(projectId, {
    splitModel: "audioshakeai",
  });

  try {
    const { project } = await client.projects.wait(operation);
    console.log("New stems:", project.stems);
  } catch (error) {
    if (error instanceof YoukaTaskError) {
      console.error("Stem separation failed:", error.code, error.message);
      throw error;
    }
    throw error;
  }
}
```

<Tip>
  Verwende `client.tasks.get(taskId)` oder `client.tasks.wait(taskId)` nur dann, wenn du
  ausdrücklich Low-Level-Zugriff auf Tasks brauchst. Die meisten Aufrufer sollten bei
  `client.projects.wait(operation)` bleiben.
</Tip>

## `client.projects.downloadStem(projectId, selector, options?)`

Lade einen Stem herunter, ohne ihn in ein anderes Format zu konvertieren. Wähle genau
einen Stem per ID oder Typ aus:

```ts theme={null}
await client.projects.downloadStem(
  "prj_abc123",
  { type: "instrumental" },
  { output: "./stems" },
);

await client.projects.downloadStem(
  "prj_abc123",
  { stemId: "stm_abc123" },
  { output: "./stems/original.wav" },
);
```

Unterstützte Typen sind `original`, `instrumental`, `vocals` und
`backing_vocals`.

## `client.projects.downloadStems(projectId, selector?, options?)`

Lade mehrere Stems herunter. Übergib `types`, übergib `stemIds` oder lasse den Selector weg,
um jeden verfügbaren Stem herunterzuladen:

```ts theme={null}
await client.projects.downloadStems(
  "prj_abc123",
  { types: ["original", "instrumental", "vocals"] },
  { output: "./stems" },
);

await client.projects.downloadStems("prj_abc123", undefined, {
  output: "./stems",
});
```

Für Downloads mehrerer Stems verwende ein Ausgabeverzeichnis. Das SDK schreibt die original
gespeicherten Stem-Dateien und transkodiert sie nicht.

## What's next

* [Lyrics sync](/de/sdk/lyrics-sync) — Lyrics nach dem Austauschen von Stems neu synchronisieren
* [Tasks](/de/sdk/tasks) — Operation-Handles und erweitertes Task-Polling
* [Split model reference](/de/desktop/split-model) — das passende Modell auswählen
