Top Related Projects
Python library for audio and music analysis
C++ library for audio and music analysis, description and synthesis, including Python bindings
Python audio and music signal processing library
🎛 🔊 A Python library for audio.
Audio processing by using pytorch 1D convolution network
Data manipulation and transformation for audio signal processing, powered by PyTorch
Quick Overview
Spleeter is an open-source audio separation library developed by Deezer. It allows users to split audio tracks into separate stems, such as vocals, drums, bass, and other instruments. Spleeter uses deep learning models to achieve high-quality source separation.
Pros
- High-quality audio separation with pre-trained models
- Easy to use, with both command-line and Python API interfaces
- Supports multiple stem configurations (2, 4, or 5 stems)
- Can process audio files in various formats (mp3, wav, ogg, etc.)
Cons
- Requires significant computational resources for processing
- Limited customization options for advanced users
- Separation quality may vary depending on the complexity of the input audio
- Large model file sizes, which can be an issue for storage-constrained environments
Code Examples
- Separating audio into two stems (vocals and accompaniment):
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
separator.separate_to_file('input_audio.mp3', 'output_directory')
- Separating audio into four stems (vocals, drums, bass, and other):
from spleeter.separator import Separator
separator = Separator('spleeter:4stems')
separator.separate_to_file('input_audio.mp3', 'output_directory')
- Using Spleeter with custom configuration:
from spleeter.separator import Separator
from spleeter.audio.adapter import get_default_audio_adapter
separator = Separator('spleeter:5stems', multiprocess=False)
audio_loader = get_default_audio_adapter()
audio, sample_rate = audio_loader.load('input_audio.mp3')
prediction = separator.separate(audio)
for instrument, audio in prediction.items():
audio_loader.save(f'output_{instrument}.wav', audio, sample_rate, 'wav', '16bit')
Getting Started
To get started with Spleeter, follow these steps:
-
Install Spleeter using pip:
pip install spleeter
-
Separate an audio file using the command-line interface:
spleeter separate -i path/to/audio_file.mp3 -p spleeter:2stems -o output_directory
-
Or use the Python API in your script:
from spleeter.separator import Separator separator = Separator('spleeter:2stems') separator.separate_to_file('path/to/audio_file.mp3', 'output_directory')
For more advanced usage and configuration options, refer to the official Spleeter documentation.
Competitor Comparisons
Python library for audio and music analysis
Pros of librosa
- More comprehensive audio analysis toolkit with a wider range of features
- Better documentation and extensive examples for various audio processing tasks
- Actively maintained with frequent updates and community support
Cons of librosa
- Slower processing speed for certain operations compared to Spleeter
- Lacks specialized source separation capabilities out of the box
- Steeper learning curve for beginners due to its extensive feature set
Code Comparison
librosa
import librosa
y, sr = librosa.load('audio.wav')
tempo, beat_frames = librosa.beat.beat_track(y=y, sr=sr)
mfcc = librosa.feature.mfcc(y=y, sr=sr)
Spleeter
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
separator.separate_to_file('audio.mp3', 'output/')
Librosa offers a more versatile approach to audio analysis, providing functions for various tasks like tempo detection and feature extraction. Spleeter, on the other hand, focuses specifically on source separation, offering a simpler API for splitting audio into different stems. While Librosa requires more code for complex operations, it provides greater flexibility. Spleeter excels in its specialized task with a more straightforward implementation for source separation.
C++ library for audio and music analysis, description and synthesis, including Python bindings
Pros of Essentia
- More comprehensive audio analysis toolkit with a wider range of features
- Supports multiple programming languages (C++, Python, JavaScript)
- Actively maintained with regular updates and contributions
Cons of Essentia
- Steeper learning curve due to its extensive functionality
- Requires more setup and configuration compared to Spleeter
- May be overkill for simple audio separation tasks
Code Comparison
Spleeter (Python):
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
separator.separate_to_file('audio_example.mp3', 'output/')
Essentia (Python):
import essentia.standard as es
audio = es.MonoLoader(filename='audio_example.mp3')()
w = es.Windowing(type='hann')
spectrum = es.Spectrum()
mfcc = es.MFCC()
for frame in es.FrameGenerator(audio, frameSize=1024, hopSize=512):
mfcc_bands, mfcc_coeffs = mfcc(spectrum(w(frame)))
This comparison highlights the different focus of each library. Spleeter is designed specifically for audio source separation, making it simpler to use for that task. Essentia, on the other hand, offers a broader range of audio analysis tools, requiring more code but providing greater flexibility for various audio processing tasks.
Python audio and music signal processing library
Pros of madmom
- Broader range of music information retrieval (MIR) tasks, including beat tracking, onset detection, and chord recognition
- More flexible and customizable for advanced users and researchers
- Provides both offline and real-time processing capabilities
Cons of madmom
- Steeper learning curve and more complex setup compared to Spleeter
- Less focused on source separation, which is Spleeter's primary function
- May require more computational resources for certain tasks
Code Comparison
madmom example:
from madmom.features.beats import RNNBeatProcessor
from madmom.features.tempo import TempoEstimationProcessor
beats = RNNBeatProcessor()(audio_file)
tempo = TempoEstimationProcessor()(beats)
Spleeter example:
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
separator.separate_to_file(audio_file, output_path)
Both libraries offer Python-based interfaces, but madmom's API is more diverse and requires more specific function calls for different MIR tasks. Spleeter, on the other hand, provides a simpler interface focused primarily on source separation.
🎛 🔊 A Python library for audio.
Pros of Pedalboard
- More versatile, offering a wide range of audio effects and processing capabilities
- Designed for real-time audio processing, making it suitable for live applications
- Provides a user-friendly API for audio manipulation
Cons of Pedalboard
- Lacks specific source separation functionality, which is Spleeter's primary focus
- May require more manual configuration for complex audio processing tasks
Code Comparison
Spleeter (source separation):
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
separator.separate_to_file('input.mp3', 'output_directory')
Pedalboard (audio effects):
from pedalboard import Pedalboard, Reverb, Delay
board = Pedalboard([Reverb(), Delay(delay_seconds=0.5)])
with AudioFile('input.mp3') as f:
audio = f.read(f.frames)
effected = board(audio, f.samplerate)
Both libraries offer Python-based audio processing, but they serve different purposes. Spleeter focuses on source separation, while Pedalboard provides a broader range of audio effects and processing tools. The choice between them depends on the specific audio manipulation requirements of your project.
Audio processing by using pytorch 1D convolution network
Pros of nnAudio
- Focuses on audio processing and spectrograms using neural networks
- Provides GPU acceleration for faster processing
- Offers a wider range of audio processing functions beyond source separation
Cons of nnAudio
- Less specialized in music source separation compared to Spleeter
- May require more setup and configuration for specific tasks
- Potentially steeper learning curve for users unfamiliar with neural network approaches
Code Comparison
nnAudio example:
import torch
from nnAudio import Spectrogram
spec_layer = Spectrogram.STFT()
spec = spec_layer(torch.randn(1, 16000))
Spleeter example:
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
prediction = separator.separate_numpy(waveform)
Summary
nnAudio is a more general-purpose audio processing library with GPU acceleration, offering a wide range of functions for spectrograms and audio analysis. Spleeter, on the other hand, is specifically designed for music source separation, making it easier to use for that particular task. nnAudio may require more setup but provides greater flexibility, while Spleeter offers a more straightforward approach to source separation with pre-trained models.
Data manipulation and transformation for audio signal processing, powered by PyTorch
Pros of pytorch/audio
- More comprehensive audio processing toolkit with broader functionality
- Seamless integration with PyTorch ecosystem for deep learning
- Active development and regular updates from a large community
Cons of pytorch/audio
- Steeper learning curve for beginners
- May require more setup and configuration for specific tasks
- Potentially higher computational requirements for some operations
Code Comparison
spleeter:
from spleeter.separator import Separator
separator = Separator('spleeter:2stems')
separator.separate_to_file('audio_example.mp3', 'output/')
pytorch/audio:
import torchaudio
waveform, sample_rate = torchaudio.load('audio_example.mp3')
spectrogram = torchaudio.transforms.Spectrogram()(waveform)
mel_spectrogram = torchaudio.transforms.MelSpectrogram()(waveform)
Summary
spleeter is focused on audio source separation, offering a straightforward API for splitting audio into stems. It's easy to use but has a narrower scope. pytorch/audio provides a more comprehensive set of audio processing tools, integrating well with the PyTorch ecosystem. While it offers greater flexibility and functionality, it may require more expertise to utilize effectively. The choice between the two depends on the specific requirements of your audio processing task.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
:warning: Spleeter 2.1.0 release introduces some breaking changes, including new CLI option naming for input, and the drop of dedicated GPU package. Please read CHANGELOG for more details.
About
Spleeter is Deezer source separation library with pretrained models written in Python and uses Tensorflow. It makes it easy to train source separation model (assuming you have a dataset of isolated sources), and provides already trained state of the art model for performing various flavour of separation :
- Vocals (singing voice) / accompaniment separation (2 stems)
- Vocals / drums / bass / other separation (4 stems)
- Vocals / drums / bass / piano / other separation (5 stems)
2 stems and 4 stems models have high performances on the musdb dataset. Spleeter is also very fast as it can perform separation of audio files to 4 stems 100x faster than real-time when run on a GPU.
We designed Spleeter so you can use it straight from command line as well as directly in your own development pipeline as a Python library. It can be installed with pip or be used with Docker.
Projects and Softwares using Spleeter
Since it's been released, there are multiple forks exposing Spleeter through either a Guided User Interface (GUI) or a standalone free or paying website. Please note that we do not host, maintain or directly support any of these initiatives.
That being said, many cool projects have been built on top of ours. Notably the porting to the Ableton Live ecosystem through the Spleeter 4 Max project.
Spleeter pre-trained models have also been used by professionnal audio softwares. Here's a non-exhaustive list:
- iZotope in its Music Rebalance feature within RX 8
- SpectralLayers in its Unmix feature in SpectralLayers 7
- Acon Digital within Acoustica 7
- VirtualDJ in their stem isolation feature
- Algoriddim in their NeuralMix and djayPRO app suite
ð Spleeter is a baseline in the ongoing Music Demixing Challenge!
Spleeter Pro (Commercial version)
Check out our commercial version : Spleeter Pro. Benefit from our expertise for precise audio separation, faster processing speeds, and dedicated professional support.
Quick start
Want to try it out but don't want to install anything ? We have set up a Google Colab.
Ready to dig into it ? In a few lines you can install Spleeter and separate the vocal and accompaniment parts from an example audio file.
You need first to install ffmpeg
and libsndfile
. It can be done on most platform using Conda:
# install dependencies using conda
conda install -c conda-forge ffmpeg libsndfile
# install spleeter with pip
pip install spleeter
# download an example audio file (if you don't have wget, use another tool for downloading)
wget https://github.com/deezer/spleeter/raw/master/audio_example.mp3
# separate the example audio into two components
spleeter separate -p spleeter:2stems -o output audio_example.mp3
:warning: Note that we no longer recommend using
conda
for installing spleeter.
â ï¸ There are known issues with Apple M1 chips, mostly due to TensorFlow compatibility. Until these are fixed, you can use this workaround.
You should get two separated audio files (vocals.wav
and accompaniment.wav
) in the output/audio_example
folder.
For a detailed documentation, please check the repository wiki
Development and Testing
This project is managed using Poetry, to run test suite you can execute the following set of commands:
# Clone spleeter repository
git clone https://github.com/Deezer/spleeter && cd spleeter
# Install poetry
pip install poetry
# Install spleeter dependencies
poetry install
# Run unit test suite
poetry run pytest tests/
Reference
- Deezer Research - Source Separation Engine Story - deezer.io blog post:
- Music Source Separation tool with pre-trained models / ISMIR2019 extended abstract
If you use Spleeter in your work, please cite:
@article{spleeter2020,
doi = {10.21105/joss.02154},
url = {https://doi.org/10.21105/joss.02154},
year = {2020},
publisher = {The Open Journal},
volume = {5},
number = {50},
pages = {2154},
author = {Romain Hennequin and Anis Khlif and Felix Voituret and Manuel Moussallam},
title = {Spleeter: a fast and efficient music source separation tool with pre-trained models},
journal = {Journal of Open Source Software},
note = {Deezer Research}
}
License
The code of Spleeter is MIT-licensed.
Disclaimer
If you plan to use Spleeter on copyrighted material, make sure you get proper authorization from right owners beforehand.
Troubleshooting
Spleeter is a complex piece of software and although we continously try to improve and test it you may encounter unexpected issues running it. If that's the case please check the FAQ page first as well as the list of currently open issues
Windows users
It appears that sometimes the shortcut command spleeter
does not work properly on windows. This is a known issue that we will hopefully fix soon. In the meantime replace spleeter separate
by python -m spleeter separate
in command line and it should work.
Contributing
If you would like to participate in the development of Spleeter you are more than welcome to do so. Don't hesitate to throw us a pull request and we'll do our best to examine it quickly. Please check out our guidelines first.
Note
This repository include a demo audio file audio_example.mp3
which is an excerpt
from Slow Motion Dream by Steven M Bryant (c) copyright 2011 Licensed under a Creative
Commons Attribution (3.0) license
Ft: CSoul,Alex Beroza & Robert Siekawitch
Top Related Projects
Python library for audio and music analysis
C++ library for audio and music analysis, description and synthesis, including Python bindings
Python audio and music signal processing library
🎛 🔊 A Python library for audio.
Audio processing by using pytorch 1D convolution network
Data manipulation and transformation for audio signal processing, powered by PyTorch
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot