Stem Splitter Core
A Rust library for high-quality, AI-powered audio stem separation.
๐ง Overview
stem-splitter-core provides the core functionality for splitting full audio tracks into individual stems such as vocals, drums, bass, and other instruments. It's designed to serve as the foundational backend for music production tools, remix apps, or DJ software.
Behind the scenes, it uses external machine learning models (like Demucs) to perform the separation locally on the user's machine.
๐ Features
- ๐ต Audio Stem Separation โ Split full tracks into vocals, drums, bass, and more
- ๐ง AI-Powered โ Uses external models like Demucs (via Python) for state-of-the-art quality
- โก Fast + Safe โ Built in Rust with strong safety guarantees and performance
- ๐๏ธ Mono & Stereo Input โ Supports mono and stereo WAV/MP3 files
- ๐ ๏ธ Pluggable Backends โ Trait-based model interface allows future integration of native or other AI inference engines
- ๐ Output as WAV โ Results are saved in
.wavformat for easy post-processing
๐ฆ Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
โ ๏ธ This crate depends on Python and external AI models. See Setup for details.
โก Quick Start
use ;
let result = split_file.expect;
println!;
๐งฐ Setup
To use this crate, you must install:
1. โ Python 3.8+
Ensure Python is installed and accessible:
2. โ Install Python Dependencies
You need to install the following Python packages:
Optionally, you can use a virtual environment:
3. โ Python Script Setup
By default, this crate uses a Python script named demucs_runner.py located at the root of the project.
If you wish to override it with your own script, set the STEM_SPLITTER_PYTHON_SCRIPT environment variable to point to your custom script:
The script must:
- Accept
--inputand--outputarguments - Use Demucs (or another model) to process the audio file
- Save 4 WAV files:
vocals.wav,drums.wav,bass.wav, andother.wavin the specified output directory
Basic stub example:
# demucs_runner.py
=
=
๐ Supported Input Formats
.wav.mp3
Other formats (like .flac, .ogg, etc.) may work depending on symphonia backend support.
๐งช Development Status
- โ MP3/WAV input decoding
- โ Python subprocess integration
- โ WAV stem writing
- โ Mono/stereo support
- ๐ ๏ธ Extensible architecture for custom inference backends
๐ค Contributing
Contributions are welcome! If you have suggestions, issues, or feature requests, feel free to open an issue or submit a pull request.
๐ชช License
Licensed under either of:
- MIT (LICENSE-MIT)
- Apache 2.0 (LICENSE-APACHE)
At your option.