[Integrations](https://spiral.ai/integrations) › [opencode](https://spiral.ai/integrations/opencode) › [Demucs](https://spiral.ai/integrations/opencode/demucs)

# How to Use Demucs in opencode

Demucs separates mixed music into stems for practice, remix preparation, and vocal extraction. Its six-source model adds guitar and piano to the usual four stems, though piano separation can contain substantial bleed and artifacts.

|  |  |
| --- | --- |
| Model | Demucs |
| Available through | fal |
| Category | Audio |
| Price | $0.00091 per second. |
| Returns | audio |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with Demucs in opencode

- Use Demucs to separate the demo song in this project's audio assets into vocals, drums, bass, and other accompaniment. Save the results beside the original in a clearly named folder.
- Use Demucs to extract the bass from the rehearsal recording in this project. Add a simple playback comparison between the original and the extracted bass.
- Use Demucs with its six-source model to separate the guitar from the project's demo recording. Keep the original available for listening comparisons.
- Use Demucs on the chorus of the project's demo song twice, with shifts set to 1 and 4. Build a listening comparison so I can choose which vocal stem to keep.
- Use Demucs with the six-source model on the piano demo in this project. Add a review note asking me to check the piano stem for bleed and artifacts before editing.

## How to set up Demucs in opencode

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the server**: Leave out `--global` to add Spiral to the current project only. No header and no client ID or secret: opencode registers itself with Spiral.

```bash
opencode mcp add spiral --global --url https://api.spiral.ai/mcp
```

2. **Sign in**: Your browser opens. Sign in to Spiral, pick the organization and click Authorize, then return to the terminal. No API key. Inside opencode, `/mcps` starts the same sign-in.

```bash
opencode mcp auth spiral
```

3. **Check it**: Spiral shows as connected.

```bash
opencode mcp list
```

### Use the Spiral skill

1. **Send opencode this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run Demucs**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "fal",
    "model": "fal-ai/demucs",
    "input": {
      "audio_url": "https://storage.googleapis.com/falserverless/model_tests/audio-understanding/Title_%20Running%20on%20Fal.mp3"
    }
  }'
```

Then paste one of the prompts above: opencode finds Demucs on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/opencode

## Demucs tools and prices

- [Demucs Stem Separation](https://spiral.ai/tools/fal/fal-ai/demucs) (fal): $0.00091 per second.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| model | htdemucs, htdemucs_ft, htdemucs_6s, hdemucs_mmi, mdx, mdx_extra, mdx_q, mdx_extra_q | htdemucs_6s | Demucs model to use for separation |
| stems |  | ["vocals","drums","bass","other","guitar","piano"] | Specific stems to extract. If None, extracts all available stems. Available stems depend on model: vocals, drums, bass, other, guitar, piano (for 6s model) |
| segment_length | 1 to … | — | Length in seconds of each segment for processing (minimum 1). Smaller values use less memory but may reduce quality. Default is model-specific. |
| shifts | 1 to 10 | 1 | Number of random shifts for equivariant stabilization. Higher values improve quality but increase processing time. |
| overlap | 0 to 1 | 0.25 | Overlap between segments (0.0 to 1.0). Higher values may improve quality but increase processing time. |
| output_format | wav, mp3 | mp3 | Output audio format for the separated stems |

## What can you do with Demucs in opencode?

Demucs lets you turn mixed music in a project into separate instrument references. A coding agent can organize the results and build listening comparisons around the extracted stems.

### Vocal practice

Extract the vocal stem from a song to study phrasing and entrances without the full accompaniment competing for attention.

### Drum practice

Separate the drums for focused listening to fills, groove, and transitions before practicing the part.

### Bass transcription preparation

Extract the bass stem as a listening reference while working out a bass line by ear.

### Remix preparation

Separate a mixed recording into stems, then audition each stem before choosing material for an arrangement.

### Guitar part study

Use the six-source model to extract a guitar reference for studying rhythm patterns and musical entrances.

### Piano part exploration

Try the six-source model for a piano listening reference. Check carefully for other instruments bleeding through before relying on individual notes.

## Overview

- [fal](https://spiral.ai/providers/fal)
- [All opencode guides](https://spiral.ai/integrations/opencode)

## Demucs in other agents

- [Amp](https://spiral.ai/integrations/amp/demucs)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/demucs)
- [Claude](https://spiral.ai/integrations/claude-desktop/demucs)
- [Claude Code](https://spiral.ai/integrations/claude-code/demucs)
- [Cline](https://spiral.ai/integrations/cline/demucs)
- [Codex](https://spiral.ai/integrations/codex/demucs)
- [Cursor](https://spiral.ai/integrations/cursor/demucs)
- [Devin](https://spiral.ai/integrations/devin/demucs)
- [dots](https://spiral.ai/integrations/dots/demucs)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/demucs)
- [Gemini](https://spiral.ai/integrations/gemini/demucs)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/demucs)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/demucs)
- [goose](https://spiral.ai/integrations/goose/demucs)
- [Grok](https://spiral.ai/integrations/grok/demucs)
- [Grok Build](https://spiral.ai/integrations/grok-build/demucs)
- [Hermes](https://spiral.ai/integrations/hermes/demucs)
- [Instinct](https://spiral.ai/integrations/instinct/demucs)
- [Manus](https://spiral.ai/integrations/manus/demucs)
- [Muse](https://spiral.ai/integrations/muse/demucs)
- [Muse Code](https://spiral.ai/integrations/muse-code/demucs)
- [n8n](https://spiral.ai/integrations/n8n/demucs)
- [Notion](https://spiral.ai/integrations/notion/demucs)
- [OpenClaw](https://spiral.ai/integrations/openclaw/demucs)
- [Perplexity](https://spiral.ai/integrations/perplexity/demucs)
- [Raycast](https://spiral.ai/integrations/raycast/demucs)
- [VS Code](https://spiral.ai/integrations/vscode/demucs)
- [Windsurf](https://spiral.ai/integrations/windsurf/demucs)
- [Zapier](https://spiral.ai/integrations/zapier/demucs)

## More opencode guides

- [DeepFilterNet 3](https://spiral.ai/integrations/opencode/deepfilternet-3)
- [Eleven Flash v2](https://spiral.ai/integrations/opencode/eleven-flash-v2)
- [Cohere Transcribe](https://spiral.ai/integrations/opencode/cohere-transcribe)
- [Eleven Flash v2.5](https://spiral.ai/integrations/opencode/eleven-flash-v2-5)
- [Chatterbox TTS](https://spiral.ai/integrations/opencode/chatterbox-tts)
- [Eleven Multilingual v2](https://spiral.ai/integrations/opencode/eleven-multilingual-v2)

## Questions about Demucs in opencode

**Can opencode use Demucs?**

Yes. Add Spiral to opencode as an MCP server, and opencode can find and run Demucs like any built-in tool.

**How much does Demucs cost in opencode?**

$0.00091 per second. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your opencode plan is separate.

**Do I need a fal account to use Demucs in opencode?**

No. Spiral runs Demucs on its own fal account. You sign in to Spiral once and never paste a key.

**How long does it take to set up Demucs in opencode?**

About two minutes: add the server, then sign in, then check it.

**Does opencode wait while Demucs runs?**

Demucs runs in the background. opencode starts the run, checks on it and gives you the audio when it's ready.

**What is Demucs useful for?**

Demucs separates mixed music into vocals, drums, bass, and other accompaniment. Those stems give you material for instrument practice, vocal study, and remix preparation.

**Can Demucs isolate guitar and piano?**

Yes, with the experimental six-source model. The developers warn that the piano stem can contain substantial bleed and artifacts, so audition it before using it in an edit.

**Will Demucs produce perfectly isolated instruments?**

Treat the results as estimated stems and check them by ear. Piano separation has a documented problem with other instruments leaking through and audible artifacts.

**Does the 7.8-second limit restrict the length of my song?**

That limit applies to processing segments in Hybrid Transformer Demucs. Demucs can split a recording into chunks and combine their predictions, so segment length is different from song length.

**When should I increase random shifts?**

Try more shifts when separation quality matters more than processing time. Demucs averages repeated predictions, so compare the result with your first pass before adopting the change.

