| Crates.io | stem-splitter-core |
| lib.rs | stem-splitter-core |
| version | 0.1.2 |
| created_at | 2025-07-29 20:48:06.747879+00 |
| updated_at | 2025-08-06 15:27:21.142448+00 |
| description | Core library for AI-powered audio stem separation |
| homepage | https://github.com/gentij/stem-splitter-core |
| repository | https://github.com/gentij/stem-splitter-core |
| max_upload_size | |
| id | 1772791 |
| size | 1,439,638 |
A Rust library for high-quality, AI-powered audio stem separation.
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.
.wav format for easy post-processingAdd this to your Cargo.toml:
[dependencies]
stem-splitter-core = "0.1.0"
โ ๏ธ This crate depends on Python and external AI models. See Setup for details.
use stem_splitter_core::{split_file, SplitConfig};
let result = split_file("example.mp3", SplitConfig {
output_dir: "./output".to_string(),
}).expect("Failed to split stems");
println!("Vocals: {} samples", result.vocals.len());
To use this crate, you must install:
Ensure Python is installed and accessible:
python3 --version
You need to install the following Python packages:
pip install demucs torch torchaudio
Optionally, you can use a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install demucs torch torchaudio
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:
export STEM_SPLITTER_PYTHON_SCRIPT=./scripts/your_custom_script.py
The script must:
--input and --output argumentsvocals.wav, drums.wav, bass.wav, and other.wav in the specified output directoryBasic stub example:
# demucs_runner.py
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("--input", required=True)
parser.add_argument("--output", required=True)
args = parser.parse_args()
subprocess.run(["demucs", "--two-stems=vocals", args.input, "-o", args.output])
.wav.mp3Other formats (like .flac, .ogg, etc.) may work depending on symphonia backend support.
Contributions are welcome! If you have suggestions, issues, or feature requests, feel free to open an issue or submit a pull request.
Licensed under either of:
At your option.