Currently spleeter supports three flavours of separation:
It would be really useful to be able to configure which specific parts to separate out.
For my use case, I want to be able to separate only the drums from the rest of the music, so after using spleeter I would get two parts: Vocals + instrumental w/o drums and the drum part.
Right now I can still achieve this with some manual work using the 4stems parameter and using software to merge the vocals, bass, and other parts together.
Hi Jeffrey, thanks for the feedback!
We'll discuss adding support for custom separation in command line. In the meantime, you can achieve what you want by using the python API. Below is an example of how to export a track with the drum part left out.
from spleeter.utils.audio.adapter import get_default_audio_adapter
from spleeter.separator import Separator
# Using embedded configuration.
separator = Separator('spleeter:4stems')
audio_adapter = get_default_audio_adapter()
sample_rate = 44100
waveform, _ = audio_adapter.load('audio_example.mp3', sample_rate=sample_rate)
prediction = separator.separate(waveform)
# Now add up all that is not drums
out = prediction["vocals"]
for key in ["bass", "other"]:
out += prediction[key]
audio_adapter.save("/output/track_without_drums.mp3", out, separator._sample_rate, "mp3", "128k")
Gonna subscribe and +1 to drums/the rest separation.
It seems logical the next step once you get the drum track out is to separate this into high hat / snare / kick layers.
This could be easily achieved by throwing different midi with different drum libraries
(There鈥檚 libraries that have high quality 230gb sounds. Apple logic has auto drumming which spit out endless possibilities.)
Using the custom training option
Given a json file
Once trained this drum track model would allow
Given the drum track spat out from spleeter
Spit out the layers stems
This could be extrapolated to entire audio collection. Happy to help anyone who wants to embark on this. Seems like a spleeter2 kind of thing. Need to herd the cats to git branches so people don鈥檛 waste efforts.
Can you please explain how to use this example with the spleeter command line with the python API ? Thanks
@Faylixe @alreadytaikeune How do the changes in v1.4.4 affect how to do custom separation with spleeter? Does your comment https://github.com/deezer/spleeter/issues/8#issuecomment-549121231 still hold true?
@JeffreyCA Can custom separation also be specified when using the separate_to_file function?
So, as long as we are waiting for upcoming release I forked the repo and added separate_drums command: https://github.com/headcloud/spleeter
Solution is based on https://github.com/deezer/spleeter/issues/8#issuecomment-549121231 but allows to use familiar syntax:
spleeter separate_drums -i audio_example.mp3 -o output
It does uses 4stems separation and saves result in 2 output files
after cloning forked repository and installing according the readme should work e.g:
python -m spleeter separate_drums -i ~/spleeter/some.mp3 -o ~/spleeter/output -c mp3
Most helpful comment
Hi Jeffrey, thanks for the feedback!
We'll discuss adding support for custom separation in command line. In the meantime, you can achieve what you want by using the python API. Below is an example of how to export a track with the drum part left out.