Skip to content

AI Stem Separation (Demucs)

Separates a mixed audio file into individual stems (vocals, drums, bass, other instruments) using Meta’s Demucs neural network. Useful for analyzing individual elements of a mixed file, or preparing stems for masking analysis.

Requires the phantom-audio[separation] extra. Add it with: uv tool install "phantom-audio[separation]" --python 3.13 --force

Parameters

ParameterTypeDefaultDescription
file_pathstringrequiredPath to mixed audio file
output_dirstringrequiredDirectory to write separated stems. Must sit inside Phantom's output directory (~/.phantom/output by default, or PHANTOM_OUTPUT_DIR). Paths outside it are rejected.

Example Output

Illustrative summary; MCP responses use structured JSON.

$ separate_stems full-mix.wav ~/.phantom/output

{ "stems": { "vocals": "/Users/you/.phantom/output/vocals.wav", "drums": "/Users/you/.phantom/output/drums.wav", "bass": "/Users/you/.phantom/output/bass.wav", "other": "/Users/you/.phantom/output/other.wav" } }

What the Numbers Mean

  • stems – A map of stem name to the WAV file path Phantom wrote it to. Each file is 16-bit PCM WAV at the model’s native sample rate.

  • output_dir – Must resolve inside PHANTOM_OUTPUT_DIR (defaults to ~/.phantom/output). A directory outside that sandbox is rejected.

  • Processing time – Stem separation uses neural networks and is CPU-intensive. Runtime depends on audio length, model, and hardware; the first run also downloads model weights.

Example Prompts

Full separation

Separate my mix into stems – I want to analyze each element individually

Vocals only

Extract just the vocals from song.wav so I can analyze them

Analysis pipeline

Separate this reference track into stems, then run masking analysis between my vocals and the reference vocals

Pro tip

Stem separation quality drops with heavily compressed or limited audio (less transient information for the model to work with). For best results, use the highest quality source available: uncompressed WAV or FLAC, before any mastering processing.

Optional analytics

With your permission, Vercel measures page views and loading performance, and PostHog measures page views and selected button clicks. We do not send search text or form details, record sessions, or link analytics to your email. Your choice lasts 180 days. You can withdraw anytime using Privacy choices in the footer. Forms work either way.

Privacy policy