A web application that separates audio into stems (vocals, drums, bass, guitar, other) using Demucs. Supports uploads, YouTube URLs, and Spotify links.
- Upload audio files for stem separation
- Extract stems from YouTube videos
- Extract stems from Spotify tracks
- High-quality separation using Demucs htdemucs_6s model
- Easy-to-use web interface built with Gradio
-
Install dependencies:
pip install -r requirements.txt
-
Install ffmpeg (required for audio processing):
- Ubuntu/Debian:
sudo apt-get install ffmpeg
- macOS:
brew install ffmpeg
- Windows: Download from ffmpeg.org
- Ubuntu/Debian:
-
Run the application:
python app.py
Warning
Running locally (or in a .venv) will automatically use CUDA if available. If you want to run it without GPU, change the line in app.py
:
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
to:
device = torch.device("cpu")
- Access the web interface at http://localhost:7860
-
Build and run with Docker:
docker build -t audio-stem-separator . docker run -p 7860:7860 audio-stem-separator
-
If you want to use GPU acceleration, ensure you have NVIDIA Container Toolkit installed. Then run:
docker build -t audio-stem-separator . docker run --gpus all -p 7860:7860 audio-stem-separator
-
Run with Docker Compose, this will automatically enable GPU support
docker-compose up --build
-
If you want to run it without GPU, use:
docker-compose -f docker-compose.cpu.yml up --build
Note
While spotify-dl
doesn't require API keys for downloading, it still needs them to access Spotify metadata.
- Visit Spotify Developer Dashboard
- Create a new application
- Set environment variables:
export SPOTIFY_CLIENT_ID="your_client_id" export SPOTIFY_CLIENT_SECRET="your_client_secret"
For Docker, add these variables to your environment:
docker run -p 7860:7860 \
-e SPOTIFY_CLIENT_ID="your_client_id" \
-e SPOTIFY_CLIENT_SECRET="your_client_secret" \
audio-stem-separator
For Docker Compose, add to docker-compose.yml:
services:
stem-separator:
environment:
- SPOTIFY_CLIENT_ID=your_client_id
- SPOTIFY_CLIENT_SECRET=your_client_secret
- Access the web interface at http://localhost:7860
- Choose a tab based on your input (Upload, YouTube, or Spotify)
- Provide the audio/URL and click "Process"
- Download the separated stems