Spleeter: [Discussion] API example

Created on 28 Nov 2019  路  7Comments  路  Source: deezer/spleeter

Anyone care to post example code of how to use the API?

Goal: Call separate_to_file()

EDIT
I forgot to mention that I'm trying to do whatever is discussed here https://github.com/deezer/spleeter/issues/112

To build the model once and re-use the model.

RTMP question

All 7 comments

Hi what exactly are you having trouble with? To use the function, its pretty much copy and paste from the docs https://github.com/deezer/spleeter/wiki/4.-API-Reference then you specify any extra parameters accordingly. Let me know if you getting any errors

I just don鈥檛 know Python :(

I thought maybe someone has a working python script to share

Okay no probs, So for multiple files it would be something like this:

from spleeter.separator import Separator

separator = Separator('spleeter:2stems')

# List of input to process.
audio_descriptors = ['audio1.mp3', 'audio2.mp3']

# Batch separation export.
for i in audio_descriptors:
    separator.separate_to_file(i, destination='OutputFolder', synchronous=False, bitrate='320k', codec='mp3')



# Wait for batch to finish.
separator.join()

I will share a complete script soon as I have been implementing an user interface as well.

Thanks. But there should be imports as well, right?

Sure I have updated the above. To process a single file it will be just

from spleeter.separator import Separator

separator = Separator('spleeter:2stems')

separator.separate_to_file('myaudio.mp3', destination='OutputFolder', synchronous=False, bitrate='320k', codec='mp3')

The model then only gets built and loaded only one time when separator = Separator('spleeter:2stems') is called

@Faylixe I have read the manual. I am a total beginner in Python. Is it not allowed to discuss with fellow Spleetermen about Spleeter related things?

Was this page helpful?
0 / 5 - 0 ratings