Demucs is an open-source Music Source Separation project by the Meta research team, corresponding to the paper "Hybrid Spectrogram and Waveform Source Separation." It can separate any song into multiple independent tracks, and currently mainly supports four source categories: drums, bass, vocals, and other accompaniment.
Main capabilities:
- Based on a U-Net convolutional architecture, inspired by Wave-U-Net.
- The v4 version introduces Hybrid Transformer Demucs, replacing the innermost layers of Hybrid Demucs with a cross-domain Transformer encoder, using self-attention within the frequency domain and waveform domain, and cross-attention across domains.
- Achieves 9.00 dB SDR on the MUSDB HQ test set; after expanding the receptive field with a sparse attention kernel and performing per-source fine-tuning, it can reach 9.20 dB SDR.
- The training data is the MUSDB HQ dataset plus an additional 800 songs.
- Provides multiple pretrained models, including htdemucs (default), htdemucs_ft (fine-tuned version, separation time about 4 times longer but possibly slightly better), htdemucs_6s (6-source version, adding guitar and piano, but the piano source currently performs poorly), hdemucs_mmi, mdx, mdx_extra, mdx_q, mdx_extra_q, etc.
- Supports --two-stems=vocals to implement karaoke mode (separating vocals and accompaniment).
- Supports options such as --shifts random shift averaging, --overlap to control prediction window overlap, and -j parallel jobs.
- Outputs 44.1 kHz stereo wav files, with optional float32, int24, or mp3 formats.
Usage:
- Requires Python 3.8 or above.
- Can be installed via PyPI: pip install demucs (please refer to the official documentation for the specific command).
- Can also be installed directly from the repository to get the latest version.
- Basic separation command: demucs audio file.
- If GPU memory is insufficient, you can use --segment to reduce the segment length, or set the environment variable PYTORCH_NO_CUDA_MEMORY_CACHING=1, or use -d cpu to run on CPU.
- Supports being called from Python programs; the main function provides the opt parameter as a simple API.
- Provides a Docker image, Google Colab notebook, and Hugging Face Spaces demo.
- The community provides graphical interfaces: CarlGao4/Demucs-Gui (Windows/macOS) and the self-contained GUI in UVR (Ultimate Vocal Remover).
- Other online services: Audiostrip and MVSep provide free online separation; Neutone provides a free VST/AU plugin for the real-time Demucs model.
Applicable scenarios:
- Stem extraction and remixing in music production.
- Karaoke accompaniment production.
- Audio research and machine learning experiments.
- Scenarios requiring local processing, privacy emphasis, or offline use.
Limitations and notes:
- The original repository is no longer maintained by Meta; the author has created the branch github.com/adefossez/demucs, which only handles important bug fixes and does not accept feature requests.
- The project is no longer actively maintained.
- The piano source separation quality in the 6-source model is poor, with considerable crosstalk and artifacts.
- The sparse Hybrid Transformer model described in the paper is not provided, because it requires custom CUDA code that has not yet been released.
- GPU acceleration requires at least 3GB of VRAM, and the default parameters require about 7GB; the maximum segment length for the Hybrid Transformer model is 7.8 seconds.
- CPU processing time is about 1.5 times the audio duration.
- The output may require clipping due to separation artifacts. Demucs automatically rescales each track to avoid clipping, but this may disrupt the relative volume between tracks.
- Licensed under the MIT License.