Skip to content

gravitasse/stemsep

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio Stem Separator

A web application that separates audio into stems (vocals, drums, bass, guitar, other) using Demucs. Supports uploads, YouTube URLs, and Spotify links.

frontend A preview of the interface

Features

  • 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

Installation

Option 1: Using pip

  1. Install dependencies:

    pip install -r requirements.txt
  2. Install ffmpeg (required for audio processing):

    • Ubuntu/Debian: sudo apt-get install ffmpeg
    • macOS: brew install ffmpeg
    • Windows: Download from ffmpeg.org
  3. 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")
  1. Access the web interface at http://localhost:7860

Option 2: Using Docker

  1. Build and run with Docker:

    docker build -t audio-stem-separator .
    docker run -p 7860:7860 audio-stem-separator
  2. 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

Option 3: Using Docker Compose

  1. Run with Docker Compose, this will automatically enable GPU support

    docker-compose up --build
  2. If you want to run it without GPU, use:

    docker-compose -f docker-compose.cpu.yml up --build

Spotify API Setup

Note

While spotify-dl doesn't require API keys for downloading, it still needs them to access Spotify metadata.

  1. Visit Spotify Developer Dashboard
  2. Create a new application
  3. 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

Usage

  1. Access the web interface at http://localhost:7860
  2. Choose a tab based on your input (Upload, YouTube, or Spotify)
  3. Provide the audio/URL and click "Process"
  4. Download the separated stems

About

WebUI for audio stem separation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.1%
  • Dockerfile 2.9%