How to use the spleeter.separator.Separator function in spleeter

To help you get started, we’ve selected a few spleeter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deezer / spleeter / tests / test_separator.py View on Github external
def test_separate(configuration, instruments):
    """ Test separation from raw data. """
    adapter = get_default_audio_adapter()
    waveform, _ = adapter.load(TEST_AUDIO_DESCRIPTOR)
    separator = Separator(configuration)
    prediction = separator.separate(waveform)
    assert len(prediction) == len(instruments)
    for instrument in instruments:
        assert instrument in prediction
    for instrument in instruments:
        track = prediction[instrument]
        assert not (waveform == track).all()
        for compared in instruments:
            if instrument != compared:
                assert not (track == prediction[compared]).all()
github deezer / spleeter / tests / test_separator.py View on Github external
def test_filename_format(configuration, instruments):
    """ Test custom filename format. """
    separator = Separator(configuration)
    with TemporaryDirectory() as directory:
        separator.separate_to_file(
            TEST_AUDIO_DESCRIPTOR,
            directory,
            filename_format='export/{filename}/{instrument}.{codec}')
        for instrument in instruments:
            assert exists(join(
                directory,
                'export/{}/{}.wav'.format(TEST_AUDIO_BASENAME, instrument)))
github deezer / spleeter / tests / test_separator.py View on Github external
def test_separate_to_file(configuration, instruments):
    """ Test file based separation. """
    separator = Separator(configuration)
    with TemporaryDirectory() as directory:
        separator.separate_to_file(
            TEST_AUDIO_DESCRIPTOR,
            directory)
        for instrument in instruments:
            assert exists(join(
                directory,
                '{}/{}.wav'.format(TEST_AUDIO_BASENAME, instrument)))
github deezer / spleeter / tests / test_separator.py View on Github external
def test_filename_confilct():
    """ Test error handling with static pattern. """
    separator = Separator(TEST_CONFIGURATIONS[0][0])
    with TemporaryDirectory() as directory:
        with pytest.raises(SpleeterError):
            separator.separate_to_file(
                TEST_AUDIO_DESCRIPTOR,
                directory,
                filename_format='I wanna be your lover')
github Jorge332 / SpleeterBox / spleeterBox.py View on Github external
def DoSeparstion(stems):
    loadingState(True)
    try:
        separator = Separator(stems)
        separator.separate_to_file(myText.get(), myDir.get(), synchronous=False)
        if tk.messagebox.askyesno(message="Process completed, open result folder?", title="Success!"):
            subprocess.Popen(f'explorer {os.path.realpath(myDir.get())}')
    except Exception as identifier:
        tk.messagebox.showinfo(message="Error: "+identifier, title="Error")

    loadingState(False)
    return
github deezer / spleeter / spleeter / commands / separate.py View on Github external
def entrypoint(arguments, params):
    """ Command entrypoint.

    :param arguments: Command line parsed argument as argparse.Namespace.
    :param params: Deserialized JSON configuration file provided in CLI args.
    """
    # TODO: check with output naming.
    audio_adapter = get_audio_adapter(arguments.audio_adapter)
    separator = Separator(arguments.configuration, arguments.MWF)
    for filename in arguments.inputs:
        separator.separate_to_file(
            filename,
            arguments.output_path,
            audio_adapter=audio_adapter,
            offset=arguments.offset,
            duration=arguments.duration,
            codec=arguments.codec,
            bitrate=arguments.bitrate,
            synchronous=False
        )
    separator.join()