Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

feat(separator): typed spectral-core session path (#172 PR 2) (#192)

2 months ago

0a785a5
Authored
Davy7/25/2026, 11:04:14 AM
Run models exported at the openkara.spectral-contract/v1 boundary
(openkara-models#23): the app computes the forward STFT from the
workspace mix window (SpectralPlans::spec), feeds the core the contract
spectral tensor plus the raw mix, and composes stems from the pre-ISTFT
and time-branch outputs: stems[s] = ispec(spectral_out[:,s]) +
time_out[:,s].

- model: parse openkara.tensor_interface / openkara.spectral_contract
  from embedded metadata; unknown interfaces and unsupported contract
  versions fail BEFORE session creation; spectral session cache keys
  carry the contract version so /v2 can never reuse a /v1 session
- spectral_session (new): load-time typed interface verification
  (exact names, order, fixed contract shapes — no output-rank or
  filename heuristics), per-chunk inference, explicit stem layouts:
  FourStem composes each source; TwoStem composes vocals and pre-mixes
  the accompaniment in the spectral domain (contract linearity, one
  inverse transform instead of three)
- inference: session-path dispatch on the declared tensor interface
  only; ring feeding factored into shared helpers used by both paths
- catalog: embedded-manifest gate accepts tensor_interface
  spectral-core alongside waveform
- preprocess: chunk size for spectral models comes from the verified
  interface (rank-5 first input; waveform rank-3 rule unchanged)

Verified against the published candidate artifact
(model-spectral-v1.0.0) and the dev waveform model on the same input:
single-window stems match within max-abs <= 1.1e-5 / rms <= 2.6e-6
(all four stems and the two-stem premix vs the dual model's in-graph
projection); full streaming end-to-end diff rms <= 3.5e-5 in both stem
modes. Gated integration tests run under OPENKARA_SPECTRAL_MODEL until
the candidate enters the catalog (issue #172 PR 4 wires CI
provisioning). cargo nextest 1190 passed; clippy/fmt clean.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Parentb2ec4f3

8 files changed
  • docs/references/contracts/spectral.md+23−6
  • src-tauri/src/separator/catalog.rs+17−2
  • src-tauri/src/separator/inference.rs+180−98
  • src-tauri/src/separator/mod.rs+1−0
  • src-tauri/src/separator/model.rs+193−3
  • src-tauri/src/separator/preprocess.rs+7−0
  • src-tauri/src/separator/spectral_session.rs+681−0
  • src-tauri/tests/phase7_spectral_session.rs
+235
−0