Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ VR Architecture Parameters:
--vr_post_process_threshold VR_POST_PROCESS_THRESHOLD Threshold for post_process feature: 0.1-0.3 (default: 0.2). Example: --vr_post_process_threshold=0.1

Demucs Architecture Parameters:
--demucs_segment_size DEMUCS_SEGMENT_SIZE Size of segments into which the audio is split, 1-100. Higher = slower but better quality (default: Default). Example: --demucs_segment_size=256
--demucs_segment_size DEMUCS_SEGMENT_SIZE Segment length in seconds, 1-100. Smaller values use less memory. Use 'Default' to use the model's configured segment length (default: Default). Example: --demucs_segment_size=40
--demucs_shifts DEMUCS_SHIFTS Number of predictions with random shifts, higher = slower but better quality (default: 2). Example: --demucs_shifts=4
--demucs_overlap DEMUCS_OVERLAP Overlap between prediction windows, 0.001-0.999. Higher = slower but better quality (default: 0.25). Example: --demucs_overlap=0.25
--demucs_segments_enabled DEMUCS_SEGMENTS_ENABLED Enable segment-wise processing (default: True). Example: --demucs_segments_enabled=False
Expand Down
2 changes: 1 addition & 1 deletion audio_separator/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def main():
vr_params.add_argument("--vr_enable_post_process", action="store_true", help=vr_enable_post_process_help)
vr_params.add_argument("--vr_post_process_threshold", type=float, default=0.2, help=vr_post_process_threshold_help)

demucs_segment_size_help = "Size of segments into which the audio is split, 1-100. Higher = slower but better quality (default: %(default)s). Example: --demucs_segment_size=256"
demucs_segment_size_help = "Segment length in seconds, 1-100. Smaller values use less memory. Use 'Default' to use the model's configured segment length (default: %(default)s). Example: --demucs_segment_size=40"
demucs_shifts_help = "Number of predictions with random shifts, higher = slower but better quality (default: %(default)s). Example: --demucs_shifts=4"
demucs_overlap_help = "Overlap between prediction windows, 0.001-0.999. Higher = slower but better quality (default: %(default)s). Example: --demucs_overlap=0.25"
demucs_segments_enabled_help = "Enable segment-wise processing (default: %(default)s). Example: --demucs_segments_enabled=False"
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import pytest
import logging
from pathlib import Path
from audio_separator.utils.cli import main
import subprocess
import importlib.metadata
Expand Down Expand Up @@ -65,6 +66,7 @@ def test_cli_version_subprocess():

# Test the CLI with no arguments
def test_cli_no_args(capsys):
"""Print usage and fail before importing inference backends when no input is supplied."""
test_args = ["cli.py"]

with patch("sys.argv", test_args), patch.dict("sys.modules", {"audio_separator.separator": None}):
Expand All @@ -76,8 +78,25 @@ def test_cli_no_args(capsys):
assert "Separate audio file into different stems." in captured.out


def test_cli_demucs_segment_size_help(capsys):
"""Keep CLI help and README examples aligned on Demucs segment seconds and the Default sentinel."""
with patch("sys.argv", ["cli.py", "--help"]):
with pytest.raises(SystemExit) as exc_info:
main()

assert exc_info.value.code == 0
help_output = capsys.readouterr().out
assert "Use 'Default' to use the model's configured segment length" in help_output
assert "Example: --demucs_segment_size=40" in help_output

readme = Path(__file__).parents[2].joinpath("README.md").read_text(encoding="utf-8")
assert "Use 'Default' to use the model's configured segment length" in readme
assert "Example: --demucs_segment_size=40" in readme


# Test with multiple filename arguments
def test_cli_multiple_filenames():
"""Forward every input filename in one separation call and log the resulting outputs."""
test_args = ["cli.py", "test1.mp3", "test2.mp3"]

# Mock the open function to prevent actual file operations
Expand Down
Loading