A simple command-line tool that uses Meta's Demucs AI model to separate mixed audio files (like MP3s or WAVs) into individual stems:
- Vocals
- Drums
- Bass
- Other (Melody/Instruments)
- Python 3.8+
- ffmpeg: Required for handling various audio formats.
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt install ffmpeg - Windows: Download from gyan.dev or use
winget install ffmpeg
- macOS:
- Clone or download this repository.
- (Optional but recommended) Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install the required Python libraries:
pip install -r requirements.txt
Run the script from your terminal, providing the path to your audio file.
python split_stems.py path/to/your/song.mp3By default, the separated stems will be saved into a separated folder in your current directory.
You can specify a custom output directory and choose which Demucs model to use:
python split_stems.py path/to/your/song.mp3 -o /path/to/output_folder -m htdemucs_ftAvailable Models (-m flag):
htdemucs(Default)htdemucs_ft(Fine-tuned, slightly better quality but takes longer)htdemucs_6s(Separates into 6 stems: vocals, drums, bass, other, piano, guitar)mdx_extramdx_extra_q(Quantized, faster but slightly lower quality)
Note: The first time you run the script, Demucs will download the pre-trained neural network weights. This may take a few minutes depending on your internet connection.