demucs

demucs

To split audio files into vocals and instrumentals.

Installation

with uv:

uv tool install --with "numpy<2" --extra-index-url https://download.pytorch.org/whl/cpu demucs

On Linux, if it starts compiling numpy, then add --python 3.12 flag.


venv method, if needed for some reason:
## 1. create throwaway dir for the job and to store venv
mkdir demucs 
cd demucs

## 2. initialize venv
python -m venv venv

# 3. activate venv
source venv/bin/activate

# 4. install the cpu-only pytorch wheel (~180 mb instead of 3.5 gb cuda)
uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu

# 5. install demucs and soundfile
pip install demucs soundfile

The thing

demucs -d cpu --two-stems=vocals track.mp3

Explanation of flags:

  • d cpu: uses CPU
  • --two-stems=vocals: produces a no_vocals.wav (instrumentals/karaoke) and vocals.wav (just the vocals)

Output files are stored in {current_dir}/separated/htdemucs/{track}/ as no_vocals.wav and vocals.wav.