High-quality audio stem separation using Demucs v4 via ONNX Runtime. Separate audio tracks into vocals, drums, bass, and other instruments with true multi-core parallelisation.
┌─────────────┐
│ Web UI │ HTML/CSS/JS (works local and remote)
└──────┬──────┘
│ HTTP/WebSocket
┌──────┴──────┐
│ API Server │ Crow C++ HTTP server
└──────┬──────┘
│
┌──────┴──────┐
│ C++ Backend │ ONNX Runtime + Demucs model
└─────────────┘ Multi-threaded processing
| Library | Quality (SDR) | Speed | Parallel | ONNX Support | Notes |
|---|---|---|---|---|---|
| Demucs v4 (htdemucs) | 9.2 dB | Slower | ✅ Excellent | ✅ Yes | Selected - Best quality, multi-threaded C++ |
| Spleeter | 7.0-7.3 dB | Fast | ⚠️ Limited | ❌ No | Python/TensorFlow, less accurate |
| Open-Unmix | 8.2-8.4 dB | Medium | ⚠️ Limited | ⚠️ Partial | Good quality, PyTorch-based |
| MDX-Net | 8.5-9.0 dB | Medium | ✅ Good | ✅ Yes | Best for vocals specifically |
Selection Rationale: Demucs v4 (htdemucs) chosen for:
# Single file
stems input.wav --output ./stems
# Batch processing
stems *.wav --batch --jobs 4
# Quality/speed trade-off
stems input.wav --model htdemucs # best quality (slower)
stems input.wav --model mdx_extra # faster, good quality
# Start local server
stems-server --port 8080
# Visit http://localhost:8080
# Drag and drop audio files, download stems
# Docker deployment
docker pull deanturpin/stems
docker run -p 8080:8080 deanturpin/stems
# Or systemd service
make install-service
Requires latest C++ compiler with C++23 support.
# macOS
brew install cmake onnxruntime libsndfile fftw
# Latest Ubuntu/Debian
apt install cmake libonnxruntime-dev libsndfile1-dev libfftw3-dev g++-13
# Arch Linux (rolling release - always latest)
pacman -S cmake onnxruntime libsndfile fftw
git clone https://github.com/deanturpin/stems.git
cd stems
make
The Demucs model must be converted from PyTorch to ONNX format (not included in git due to size):
# Automated conversion (recommended)
./scripts/download_model.sh
# Or follow manual steps in models/README.md
This downloads and converts the model (~300MB, takes 5-10 minutes).
stems/
├── src/ # Core C++ stem separation logic and CLI
│ ├── main.cxx
│ ├── stem_processor.cxx
│ └── onnx_wrapper.cxx
├── include/ # Public headers
│ ├── stem_processor.h
│ └── onnx_wrapper.h
├── models/ # ONNX model files (download separately)
│ └── htdemucs.onnx
├── tests/ # Unit tests
├── CMakeLists.txt # CMake build configuration
└── Makefile # Top-level build wrapper
Contributions welcome! Please read CONTRIBUTING.md first.
MIT Licence - see LICENCE for details.
34 commits
C++
80.7%
Shell
10.3%
Python
6.0%
CMake
2.5%
High-quality audio stem separation using Demucs v4 via ONNX Runtime. Separate audio tracks into vocals, drums, bass, and other instruments with true multi-core parallelisation.
┌─────────────┐
│ Web UI │ HTML/CSS/JS (works local and remote)
└──────┬──────┘
│ HTTP/WebSocket
┌──────┴──────┐
│ API Server │ Crow C++ HTTP server
└──────┬──────┘
│
┌──────┴──────┐
│ C++ Backend │ ONNX Runtime + Demucs model
└─────────────┘ Multi-threaded processing
| Library | Quality (SDR) | Speed | Parallel | ONNX Support | Notes |
|---|---|---|---|---|---|
| Demucs v4 (htdemucs) | 9.2 dB | Slower | ✅ Excellent | ✅ Yes | Selected - Best quality, multi-threaded C++ |
| Spleeter | 7.0-7.3 dB | Fast | ⚠️ Limited | ❌ No | Python/TensorFlow, less accurate |
| Open-Unmix | 8.2-8.4 dB | Medium | ⚠️ Limited | ⚠️ Partial | Good quality, PyTorch-based |
| MDX-Net | 8.5-9.0 dB | Medium | ✅ Good | ✅ Yes | Best for vocals specifically |
Selection Rationale: Demucs v4 (htdemucs) chosen for:
# Single file
stems input.wav --output ./stems
# Batch processing
stems *.wav --batch --jobs 4
# Quality/speed trade-off
stems input.wav --model htdemucs # best quality (slower)
stems input.wav --model mdx_extra # faster, good quality
# Start local server
stems-server --port 8080
# Visit http://localhost:8080
# Drag and drop audio files, download stems
# Docker deployment
docker pull deanturpin/stems
docker run -p 8080:8080 deanturpin/stems
# Or systemd service
make install-service
Requires latest C++ compiler with C++23 support.
# macOS
brew install cmake onnxruntime libsndfile fftw
# Latest Ubuntu/Debian
apt install cmake libonnxruntime-dev libsndfile1-dev libfftw3-dev g++-13
# Arch Linux (rolling release - always latest)
pacman -S cmake onnxruntime libsndfile fftw
git clone https://github.com/deanturpin/stems.git
cd stems
make
The Demucs model must be converted from PyTorch to ONNX format (not included in git due to size):
# Automated conversion (recommended)
./scripts/download_model.sh
# Or follow manual steps in models/README.md
This downloads and converts the model (~300MB, takes 5-10 minutes).
stems/
├── src/ # Core C++ stem separation logic and CLI
│ ├── main.cxx
│ ├── stem_processor.cxx
│ └── onnx_wrapper.cxx
├── include/ # Public headers
│ ├── stem_processor.h
│ └── onnx_wrapper.h
├── models/ # ONNX model files (download separately)
│ └── htdemucs.onnx
├── tests/ # Unit tests
├── CMakeLists.txt # CMake build configuration
└── Makefile # Top-level build wrapper
Contributions welcome! Please read CONTRIBUTING.md first.
MIT Licence - see LICENCE for details.
34 commits
C++
80.7%
Shell
10.3%
Python
6.0%
CMake
2.5%