spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

Feature Request: Support custom combination of music parts

Open JeffreyCA opened this issue 6 years ago • 9 comments

Currently spleeter supports three flavours of separation:

  • Vocals / accompaniment
  • Vocals / drums / bass / other
  • Vocals / drums / bass / piano / other

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.

JeffreyCA avatar Nov 03 '19 05:11 JeffreyCA

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")

alreadytaikeune avatar Nov 03 '19 09:11 alreadytaikeune

Gonna subscribe and +1 to drums/the rest separation.

just-jeb avatar Nov 10 '19 14:11 just-jeb

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’s 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

  • the different isolated drum stems (one was of high hats / snares / kicks )
  • the mixed down layer Run the training

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’t waste efforts.

johndpope avatar Nov 10 '19 21:11 johndpope

Can you please explain how to use this example with the spleeter command line with the python API ? Thanks

vinzo99 avatar Nov 19 '19 09:11 vinzo99

@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 avatar Nov 24 '19 05:11 JeffreyCA

@JeffreyCA Can custom separation also be specified when using the separate_to_file function?

Scylla2020 avatar Nov 26 '19 08:11 Scylla2020

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

  • mix.{codec}
  • drums.{codec}

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

headcloud avatar Apr 17 '20 00:04 headcloud

Hey guys, any update on this? Will it be added to the command line interface anytime soon?

just-jeb avatar Mar 04 '21 21:03 just-jeb

Perhaps another way of looking at this request is to remove/subtract a certain track. Eg karaoke mode where you just remove vocals, a mode for bassists where you keep everything but the bass.

This would be handy for myself and many other musos!

SpitFire-666 avatar May 02 '21 11:05 SpitFire-666