Skip to content

feat(settings): separation quality (--shifts) setting - #308

Merged
thcp merged 1 commit into
mainfrom
feat/separation-quality-shifts
Jul 17, 2026
Merged

feat(settings): separation quality (--shifts) setting#308
thcp merged 1 commit into
mainfrom
feat/separation-quality-shifts

Conversation

@thcp

@thcp thcp commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

PR-3D of Phase 3 (Performance) -- the --shifts roadmap item from #274.

  • app/core/settings.py: get_separation_quality() / set_separation_quality(v), choices ("standard", "best"), default standard, env seed STEMDECK_SEPARATION_QUALITY. Follows the demucs_device pattern exactly.
  • app/main.py: added to _settings_payload() and the POST /api/settings handler (422 on an invalid choice).
  • app/pipeline/separate.py: _demucs_cmd appends --shifts 2 when quality is "best", read fresh per job (same as get_demucs_device()) so a Settings change applies to the next separation without a restart. Applies on any device.
  • Settings UI (static/js/catalog.js): new "Separation quality" select on the General tab, next to Compute device -- Standard / Best (2× slower), wired the same way as the export sample rate / video height selects.

Test plan

  • tests/test_network_gate.py: settings round-trip via the API, env-var seeding, rejection of an unknown choice (nothing persisted on failure).
  • tests/test_separate_fallback.py: _demucs_cmd includes --shifts 2 at "best", omits it at "standard"; existing fallback tests unaffected (they stub _demucs_cmd directly).
  • Full suite: 201 passed, 12 skipped
  • ruff check / ruff format --check clean

Adds a "Standard" / "Best (2x slower)" separation quality setting,
following the demucs_device runtime-settings pattern exactly
(app/core/settings.py get/set + env seed, app/main.py payload + POST
handler with 422 on an invalid choice).

"Best" appends --shifts 2 to the demucs invocation: separation runs
twice on a randomly time-shifted copy of the input and averages the
two passes -- measurably cleaner stems, ~2x the separation time.
Applies on any device; a CPU user who opts in accepts the wait
knowingly.

Settings UI: new select next to Compute device on the General tab,
wired the same way as the export sample rate / video height selects.
@thcp
thcp merged commit 68c449d into main Jul 17, 2026
8 checks passed
@thcp
thcp deleted the feat/separation-quality-shifts branch July 17, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant