Skip to content

[Bug]: chunk_duration param causes issue if custom_output_names does not follow the regex. #259

@Kulin-Soni

Description

@Kulin-Soni

Describe the bug

After setting chunk_duration parameter in the Separator's initialization, there seems to be some issue with how file chunking and merging is handled unless the name follows the regex _\(([^)]+)\) which is from the _process_with_chunking method in Separator class.

In this case, it creates files as test_(stem_0).wav, test_(stem_1).wav... . These all contain the processed version of last chunk.

separator = Separator(
    output_dir="output"
    output_single_stem="Vocals",
    chunk_duration=600,
)
separator.load_model()
separator.separate("source.wav", {"Vocals": "test_vocals"})

The following case works fine:

separator.separate("source.wav", {"Vocals": "test_(foo)"})

I've tested this with instrumental aswell (with and without output_single_stem), and the issue persists.
If this issue is only for me or if am missing something, please let me know.

Expected Behaviour

Creates a single file test_vocal.wav that contains all the chunks combined with full audio.

Have you searched for existing issues? 🔎

  • I have searched and found no existing issues.

Screenshots or Videos

No response

Logs

WARNING - separator - Could not extract stem name from test_vocals.wav, using stem_2
INFO - separator - Merging 1 chunks for stem: stem_0
INFO - audio_chunking - Merging 1 chunks into test\test_(stem_0).wav
INFO - audio_chunking - Exporting merged audio (237.5s) to test\test_(stem_0).wav
INFO - separator - Merging 1 chunks for stem: stem_1
INFO - audio_chunking - Merging 1 chunks into test\test_(stem_1).wav
INFO - audio_chunking - Exporting merged audio (237.5s) to test\test_(stem_1).wav
INFO - separator - Merging 1 chunks for stem: stem_2
INFO - audio_chunking - Merging 1 chunks into test\test_(stem_2).wav
INFO - audio_chunking - Exporting merged audio (237.5s) to test\test_(stem_2).wav
INFO - separator - Chunked processing completed. Output files: ['test\\test_(stem_0).wav', 'test\\test_(stem_1).wav', 'test\\test_(stem_2).wav']

System Info

Operating System: Windows 11
Python version: 3.13.2
FFMPEG version: 8.0.1
pydub version: 0.25.1
python-audio-separator version: 0.41.1

Additional Information

I have tested this with other models aswell and they have the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions