Getting weird Spleeter error and how to address it

379 views Asked by At

I'm trying to use Spleeter to get a dictionary of the separate tracks (vocals, bass, etc.) from a wav file and the following is my code:

def seperator():
    separator = Separator('spleeter:4stems')
    file = "test.wav"
    audio_loader = AudioAdapter.default()
    sample_rate = 44100
    waveform, _ = audio_loader.load(file, sample_rate=sample_rate)
    prediction = separator._separate_librosa(waveform, file)
    print(prediction['vocals'])


def do_seperation():
    __name__ = '__main__'
    if __name__ == '__main__':
        seperator()

However, I get the following error message

RuntimeError: 
    An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

This seems to be a common error in Spleeter as I've gotten this error message before but have been able to resolve this by using if __name__ == '__main__': as a wrapper for my function but this time it isn't working. Is there any way to resolve this weird error? Any help appreciated, thanks!

0

There are 0 answers