Skip to content

feat(mixer): per-channel voice isolation - #1036

Open
wagenet wants to merge 7 commits into
Eyevinn:mainfrom
wagenet:wagenet/mixer-voice-isolation
Open

wagenet wants to merge 7 commits into
Eyevinn:mainfrom
wagenet:wagenet/mixer-voice-isolation

Conversation

@wagenet

@wagenet wagenet commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A remote guest sends whatever is around them to air: music, a TV, fans, kitchen noise. The HPF and gate can't remove it, because that sound overlaps speech in level and frequency.

Change

A per-channel Voice isolation switch in the mixer, between the HPF and the gate. The properties are chN_voice_isolation and chN_voice_isolation_limit (maximum cut in dB); both are live and appear in the channel detail panel.

The new element, stromvoiceisolation, runs DPDFNet (dpdfnet2_48khz_hr, Ceva, Apache-2.0 code and weights) with tract, a pure-Rust ONNX runtime. Off, it passes audio through untouched. On, it runs the model on the channel's mono downmix and writes the result to every channel. Switching it on or off crossfades over 10 ms. The model loads off the streaming thread on first enable; if loading fails, the element posts a warning and stays dry. The model runs only at 48 kHz, so a mixer at another rate gets audioresample + capsfilter around the element.

Latency. The element reports none. An enabled channel's audio is 60 ms late inside unchanged timestamps instead: 50 ms for the model plus one hop of buffering, so buffers that are not whole hops are always answered in full. Reporting it is possible (Strom already recalculates latency when a Time Offset changes live), but audiomixer reports the largest latency among its inputs, and the pipeline applies the highest latency of any sink to every sink, video included. One enabled channel would then delay every output of the flow by 60 ms, the conversation return included, and each toggle would re-sync every sink. This way only the enabled channel pays, and its audio trails its video by 60 ms, which is at the EBU R37 limit.

Build. build.rs downloads the 10.6 MB model, checks its sha256, and embeds it in the binary; STROM_VOICE_ISOLATION_MODEL points at a local copy for offline builds. Everything sits behind the default-on voice-isolation feature. Debug builds compile the tract and FFT crates at opt-level = 3, because unoptimised inference can't keep up with live audio.

Rejected: DeepFilterNet3 (dormant, unclear weight licence); RNNoise (about 3 dB off the music); onnxruntime via ort (about half the CPU, but its prebuilt needs glibc 2.38 and libstdc++, so the zigbuild Linux release builds against glibc 2.31 cannot link it).

Evidence

Model, offline on a real 47-minute, four-guest recording, through the onnxruntime reference (sherpa-onnx): about 40 dB off an in-room instrument, with that guest's voice changed by −0.15 dB; clean speech changed 0.06–0.15 dB (median); voiced laughter kept, breaths and knocks reduced 40–95 dB. Judged good enough by ear. Long or overlapping laughter is untested.

Element. Each test below fails when the behaviour it guards is removed; each removal was run on this head:

  • enabled_suppresses_noise_and_switches_back_cleanly: on cuts noise by at least 20 dB with sizes and timestamps unchanged, and off returns the exact dry signal. Without the wet mix: noise only reduced 0.0 dB. Without the fade back: buffer 0 after disabling is not the dry signal.
  • odd_buffer_sizes_come_back_whole_and_60_ms_late: at a 0 dB limit the wet signal is the input itself, so every output sample must equal the input exactly 2880 samples earlier, for buffers of 1 to 1024 frames. Without the padding hop: output never became the delayed input.
  • disabled_passes_audio_through_unchanged: bit-exact while off, until an enabled element fed the same audio has been running for 1 s, so the window outlasts a model load however slow the host. With enabled ignored, under background priority (taskpolicy -b): buffer 40 changed while disabled.
  • reset_engine_matches_a_fresh_one: a reset engine must answer the same audio exactly as a fresh one. tract's GRUs keep their final hidden state between runs of one session instead of starting from the model's initial_h, and DPDFNet's GRUs run across frequency inside each frame, so reusing one session for every hop leaked each frame into the next. A single hop still matched onnxruntime, so the earlier comparison missed it; over a live call the drift cut a guest's speech 36–98 dB. Each hop now runs in a fresh session (+0.13 ms per hop). With the session reused: the outputs differ by 1.02e-4.
  • element_is_finalized_after_running: with a leaked reference: voice isolation element still alive after drop.
  • test_voice_isolation_converts_around_a_non_48k_mixer: without the conversion: link mx:hpf_0 -> mx:voiceiso_0: Noformat.
  • test_voice_isolation_sits_between_hpf_and_gate: with the element left unlinked, the placement assertion fails.

Tests

Ran, on macOS arm64 at eb76ed7, before the rebase onto main: cargo test --workspace voice_isolation (6 passed), mixer (84 passed, 2 already ignored), pipeline_lifecycle_test, clippy -D warnings with and without default features, fmt --check. After the rebase, at 3f66f15: cargo check --all-targets and cargo test --workspace voice_isolation (6 passed). At 4feb25c (fresh tract session per hop): cargo test --release voice_isolation (7 passed), clippy --all-targets, fmt --check; the fixed engine run offline over the meeting recording that exposed the bug stays within about 1 dB of onnxruntime in every 10 s window. After the rebase onto main at 7c55a1b (86 commits; Cargo.lock regenerated, voice isolation registered in register_static_plugins): cargo check --workspace --locked --all-targets, cargo test --lib voice_isolation (7 passed), cargo test --lib mixer (87 passed, 2 ignored), cargo test --test openapi_test, clippy --all-targets -D warnings, fmt --check. After the rebase onto main at 7c80005 (head 357c04e; Cargo.lock regenerated): cargo check --workspace --locked --all-targets, cargo test --lib voice_isolation (7 passed), cargo test --lib mixer (87 passed, 2 ignored), cargo test --test openapi_test, cargo test --test pipeline_lifecycle_test (4 passed), clippy and fmt --check from the pre-commit hook.

CI: at eb76ed7, before the rebase, Check (Linux) ran and passed all 6 voice_isolation tests, and both Linux zigbuild release builds passed. Check (Linux) then failed on static_underlays_are_not_reuploaded_gpu, a GPU vision mixer test this PR does not touch; a fork run of the same commit passed it. Windows tests passed in a fork dispatch (wagenet/strom run 37671643619; the upstream job needs the ci:windows label), but that run's release build hit the job's 45-minute limit; see For the reviewer. Check (Linux) on 7c55a1b failed only on its 25-minute timeout-minutes: every step passed, but the run restored no cache and the test build took 10m29s. The run on 357c04e has not finished.

Not run: CI on 357c04e; the full cargo test --workspace; the ARM64 Docker build (it now builds with voice-isolation); the fix in a live meeting; macOS and Windows CI (label-gated); the GUI section in a running Strom; CPU inside Strom.

For the reviewer

  • Binary size: +34.5 MB on macOS arm64 release (98.2 → 132.7 MB, same commit with and without the feature).
  • CPU: about 2 ms per 10 ms of audio per enabled channel, measured in a standalone program on an M4, not inside Strom. Disabled channels cost a downmix copy.
  • Memory: 46 MB resident per enabled channel (four channels in one process); each channel loads its own copy of the model.
  • Windows CI time: compiling tract at opt-level = 3 adds about 5 minutes to tests and 2–3 to the release build on runs without sccache. Fork dispatches have no cache and include the release build, so they reach the job's 45-minute limit (two of three were cut off there, after tests passed; the release build passed on 66c8913 in 41 minutes). Upstream PR runs skip the release build; main runs use sccache, so after the first one tract should come from the cache (unmeasured).
  • Build-time download of the model from the sherpa-onnx GitHub release unless STROM_VOICE_ISOLATION_MODEL is set.

Known limits

  • 44.1 kHz mixers lose the top of the band even with voice isolation off. The conversion around the element is always present, so audio above about 20 kHz drops by 12 dB, and every channel runs two extra resamplers. 48 kHz mixers, the default, are unaffected.
  • Switching on costs one buffer about 7× the steady cost (six model passes to prime the engine, on the streaming thread). That's about 14 ms on an M4 against the mixer's 30 ms latency; a much slower host could miss the deadline at the moment of the switch.
  • After a feed gap, the last 60 ms before the gap play when the feed resumes. That audio was still in the delay when the gap began.
  • Switching on replays the last 60 ms; switching off skips 60 ms. The crossfade is 10 ms, but the wet path is 60 ms behind the dry one, so a toggle repeats or drops that much audio. Avoid toggling mid-sentence.
  • No option to delay video to match an enabled channel.
  • GPU inference: not tried. Each call is one 10 ms frame for one stream, so dispatch overhead would likely exceed the CPU cost (unmeasured).

🤖 Generated with Claude Code

@wagenet
wagenet marked this pull request as ready for review October 7, 2026 22:10

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Request changes. The element is well built and its guard tests ran in CI. But one premise of the latency design is wrong, and the default-on build cost needs a maintainer's call.

Requested changes

  1. Fix the latency premise in the PR body, or argue it again. The body says "Strom never recalculates pipeline latency". Strom already does that for a live property change, in backend/src/gst/pipeline/properties.rs:210 — let _ = self.pipeline.recalculate_latency(); (the Time Offset path). Voice isolation could report 60 ms only while enabled and use the same path. The remaining argument against that is narrower: audiomixer would then hold back every channel of the mix while one channel is on. Say whether that is the reason, because it decides whether the design is right.
  2. Re-run the failed jobs (gh run rerun 37671616522 --failed). Check (Linux) went red on static_underlays_are_not_reuploaded_gpu (underlay pads hold a frame with no zone configured), in a file this diff does not touch. Because that step failed, volume_ramp_test, the whip_* tests, and the strom-types and strom-frontend steps never ran. This diff changes types/src/mixer.rs and frontend/src/mixer/.

For the maintainer — default-on cost

  • Every build downloads a model from another project's release. backend/Cargo.toml:10 — default = ["nvidia", "voice-isolation"]. The source is backend/build.rs:392. The sha256 pin makes the file safe, but not available: if that asset moves, every default build breaks, offline builds included unless STROM_VOICE_ISOLATION_MODEL is set. The binary grows by 34.5 MB.
  • The weights ship inside the binary under Apache-2.0 (Ceva). This PR adds no attribution or NOTICE for them. EXTERNAL: what redistribution requires here.
  • 44.1 kHz mixers lose quality even with the switch off. The resample pair is always built at a non-48 kHz rate, from backend/src/blocks/builtin/mixer/voice_isolation.rs:93 — let (in_first, in_last) = convert("in", voice_isolation::SAMPLE_RATE)?;. Per the PR body that costs −12 dB above 20 kHz on every 44.1 kHz flow. One option: build the conversion only when the flow starts with the switch on.

Claims

Claim Verdict Evidence
Strom never recalculates latency CONTRADICTED backend/src/gst/pipeline/properties.rs:210, above
Off is bit-exact passthrough CONFIRMED passthrough only reads the buffer (downmix into history). disabled_passes_audio_through_unchanged printed ok in job 112964538701
On writes a mono result to every channel CONFIRMED backend/src/gst/voice_isolation/imp.rs:422 — *s = *s * (1.0 - g) + w * g;, with one wet sample per frame. A stereo source collapses to mono while the switch is on
The element is finalized after running CONFIRMED element_is_finalized_after_running ran and passed in the same job

Radius. GLOBAL. The block chain is local to the mixer, but the default feature changes every build: a network fetch in build.rs, binary size, and dev-profile opt-level overrides in the workspace Cargo.toml. Lock order is consistent (state, then settings).

Overlaps.

  • #898 and #930 change the same per-channel chain in mixer/builder.rs. Land #898 (standing Approve) first.
  • #1002 and #1034 both rewrite Cargo.lock. Regenerate the lock against whichever lands first.

Tests & CI. All 6 voice_isolation tests executed and passed in Check (Linux), and both Linux builds are green. macOS and Windows were skipped here. The Windows evidence is the author's fork dispatch, so ask for the ci:windows label before merge, for the build-time curl and compile time.

Confidence: HIGH

@wagenet

wagenet commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Claude here, replying for @wagenet.

Thanks for the review. I rebased onto main (3f66f159), which started a new CI run.

1. Latency premise. You're right: properties.rs:210 already recalculates latency for a live Time Offset change. I've corrected the body. The reason not to report the 60 ms is the one you named, and it goes past audiomixer. The mixer would take on the 60 ms, and the pipeline would then apply it to every sink, video included. One enabled channel would delay every output of the flow, including the conversation return, and each toggle would re-sync every sink. Keeping the delay inside the channel means only that guest pays, at 60 ms audio-behind-video, which is the EBU R37 limit.

2. CI. Re-running on the rebased head.

3. 44.1 kHz with the switch off. Agreed that a disabled feature shouldn't cost quality. Two ways to fix it:

  • Build the conversion only when the flow starts with the switch on (your suggestion). It's the simplest. On a non-48 kHz mixer, though, the switch can no longer be turned on live.
  • Resample inside the element, only while it's enabled. Off would be bit-exact passthrough at any rate, and the live switch would keep working. The cost is more element code and a pure-Rust resampler dependency, likely rubato.

I have no strong preference. Is losing the live switch at 44.1 kHz acceptable, or worth the extra code to keep?

Attribution. I can add a NOTICE crediting the DPDFNet weights (Ceva, Apache-2.0). Whether shipping the weights inside the binary needs anything more is for the maintainer.

Build-time download and default-on feature. Also the maintainer's call. If an external asset in the default build is a blocker, the options are to make voice-isolation off by default or to host the model somewhere Strom controls.

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Comment. This replaces my review at eb76ed7 and moves it from Request changes to Comment. Both requested changes are dealt with: the body now gives the right latency argument, and CI ran again. The diff itself is unchanged since eb76ed7. Comparing the two heads over this PR's files shows only lines that came from main in the rebase. Two things still keep this from an Approve: a red Check (Linux) that this diff did not cause, and the maintainer's decisions below.

Requested changes

  1. Re-run the failed job (gh run rerun 37813364018 --failed). Check (Linux) failed in stinger_prores_test (a_prores_clip_after_another_format_still_airs, left: 29 right: 30 frames). That is a stinger timing test this diff does not touch, from the same family as #1055. The cost is that Run tests on shared types and Run tests on frontend were skipped, and this diff changes types/src/mixer.rs and frontend/src/mixer/. For two runs now, those steps have not executed against this change.

For the maintainer, still open, and the author asked you directly:

  • 44.1 kHz with the switch off. backend/src/blocks/builtin/mixer/voice_isolation.rs:93 — let (in_first, in_last) = convert("in", voice_isolation::SAMPLE_RATE)?; is always built at a non-48 kHz rate. The author offers two fixes: build the conversion only when the flow starts with the switch on, which loses the live switch at 44.1 kHz, or resample inside the element only while it is enabled, which needs more code and a resampler crate.
  • Default-on build-time download from another project's release: backend/build.rs:392 — "https://github.com/k2-fsa/sherpa-onnx/releases/download/speech-enhancement-models/dpdfnet2_48khz_hr.onnx"; with backend/Cargo.toml:10 — default = ["nvidia", "voice-isolation"]. The options are to keep it, make the feature off by default, or host the model somewhere Strom controls.
  • Attribution for the embedded weights (Ceva, Apache-2.0). There is still no NOTICE in the tree, and the author has offered to add one. EXTERNAL: what redistribution requires.

Claims

Claim Verdict Evidence
Strom already recalculates latency on a live change (corrected body) CONFIRMED backend/src/gst/pipeline/properties.rs:210 — let _ = self.pipeline.recalculate_latency();
Reporting 60 ms would delay every sink, video included EXTERNAL Assumes standard audiomixer and pipeline latency aggregation. This is the reason the body now gives for keeping the delay inside the channel
The 6 voice_isolation tests ran in CI at this head CONFIRMED All six print ... ok in job 113435663380 at 3f66f15. pipeline_lifecycle_test also ran before the stinger failure

Radius. GLOBAL, unchanged from my previous review. The feature is on by default, so it changes every build: a network fetch, 34.5 MB more binary, and dev-profile opt-level overrides.

Overlaps. #898 and #930 change the same per-channel chain in mixer/builder.rs. #1002 and #1017 rewrite Cargo.lock. Whichever of these lands second needs a rebase. None of them owns the decisions above.

Tests & CI. At 3f66f15: Build (Linux x86_64/ARM64), Check & Build (WASM) and API Contract Check are green. Check (Linux) is red, as described above. macOS and Windows were skipped. The Windows evidence is still the author's fork dispatch, so add the ci:windows label before merge to check the build-time download and the compile time on that runner.

Confidence: HIGH

@srperens
srperens dismissed their stale review October 9, 2026 08:08

Superseded by my review at 3f66f15: both requested changes are addressed, and the verdict is now Comment.

wagenet added a commit to wagenet/strom that referenced this pull request Oct 9, 2026
# Conflicts:
#	backend/src/blocks/builtin/mixer/tests.rs
#	backend/src/gst/mod.rs
#	backend/src/main.rs
wagenet added a commit to wagenet/strom that referenced this pull request Oct 9, 2026
Eyevinn#1036 puts the element on every mixer channel; Eyevinn#898's tests build the
mixer without registering it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Comment. This replaces my review at 3f66f15, and the verdict is still Comment. The one new commit, 4feb25c, is a correct and well-aimed fix. CI is now fully green, so the requested re-run is no longer needed. The three maintainer decisions from my last review are still open, and they are what keeps this from an Approve.

For the maintainer (unchanged since 3f66f15. Each one still needs your call):

  • 44.1 kHz with the switch off: backend/src/blocks/builtin/mixer/voice_isolation.rs:93 — let (in_first, in_last) = convert("in", voice_isolation::SAMPLE_RATE)?;
  • Default-on build-time download from another project's release: backend/Cargo.toml:10 — default = ["nvidia", "voice-isolation"]
  • Attribution for the embedded weights (Ceva, Apache-2.0). There is still no NOTICE in the tree.

The new commit. Before, the engine spawned one tract session at load and reused it for every hop. Now each hop runs in a new session: backend/src/gst/voice_isolation/engine.rs:155 — .run(tvec!(spec.into(), state.into())) on plan: Arc<TypedRunnableModel>. The cause the commit gives also explains a second problem: Engine::reset never cleared the GRU state that the session held. That matters because the element calls reset every time it is enabled: backend/src/gst/voice_isolation/imp.rs:353 — engine.reset();. So before this fix, turning isolation off and on again did not give a clean start either. The fix covers both, and the new test is aimed at exactly that.

Claims

Claim Verdict Evidence
tract keeps GRU hidden state between runs of one session, and SimplePlan::run starts a new session on every call EXTERNAL tract internals. I assume it from the commit message and from the new test passing
reset_engine_matches_a_fresh_one would fail on a reused session UNVERIFIED I cannot build here. The test reaches the changed code through the real Engine (backend/src/gst/voice_isolation/tests.rs:269 — fn reset_engine_matches_a_fresh_one() {). But no run at 3f66f15 included it, so no output shows it failing without the fix
About 0.13 ms extra per 10 ms hop EXTERNAL Measured by the author. It is paid per enabled channel on the streaming thread, and each hop now also allocates a session's state. This is not a pad probe, so the CLAUDE.md probe rule does not apply. On a mixer with many isolated channels it is a real cost, but a small one

Radius. GLOBAL, unchanged, because the feature is on by default. The new commit on its own is LOCAL to engine.rs.

Overlaps. #898 and #930 change the same per-channel chain in mixer/builder.rs. #1002, #1017 and #897 change Cargo.lock. Whichever of these lands second needs a rebase. None of them owns the decisions above.

Tests & CI. At 4feb25c: Check (Linux), Build (Linux x86_64/ARM64), Check & Build (WASM), API Contract Check and Static JS Tests are green. In Check (Linux), Run tests on shared types and Run tests on frontend both succeeded this time. All five gst::voice_isolation::tests passed, including the new reset_engine_matches_a_fresh_one, and so did both mixer voice_isolation_tests. macOS and Windows were skipped. Before merge, add ci:windows to check the build-time download on that runner.

Confidence: HIGH

wagenet added a commit to wagenet/strom that referenced this pull request Oct 21, 2026
# Conflicts:
#	backend/src/gst/mod.rs
#	backend/src/main.rs
wagenet added a commit to wagenet/strom that referenced this pull request Oct 28, 2026
wagenet added a commit to wagenet/strom that referenced this pull request Oct 28, 2026
The mixer puts voice isolation on every channel (Eyevinn#1036), and the element is
registered by the binary, not by the plugin scan. Glue between Eyevinn#898 and Eyevinn#1036.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wagenet
wagenet force-pushed the wagenet/mixer-voice-isolation branch from 4feb25c to 7c55a1b Compare October 28, 2026 16:32
@wagenet

wagenet commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Claude here, replying for @wagenet.

Rebased onto current main (86 commits). Head is now 7c55a1b2; the old 4feb25c5 is gone, so any review pinned to it is stale. Two conflicts: Cargo.lock (regenerated from main's, not hand-merged) and main.rs, where main moved plugin registration into register_static_plugins(); the voice isolation element now registers there. No other change to what the PR does. Tests run are listed in the Tests section.

@srperens srperens left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Area: mixer / audio DSP, build (Cargo features, build.rs)

Adds a per-channel DPDFNet voice isolation element (tract), placed between the HPF and the gate. The element looks sound. The loader thread holds no element reference (backend/src/gst/voice_isolation/imp.rs:323), and the PR adds no probes or closures over pipeline objects. Since 4feb25c the change is only the rebase: registration moved into register_static_plugins (backend/src/gst/mod.rs:62) and Cargo.lock was regenerated. Three maintainer decisions from earlier reviews are still open: resampling at 44.1 kHz, the default-on download, and the NOTICE.

Neighbours: #1102 makes LSP a feature, adds a --no-default-features CI step and rewrites the ARM64 feature list in Dockerfile. Whichever lands second has to add voice-isolation to that list, or decide not to. #898 and #930 change the same chain in mixer/builder.rs.

  1. CI is red because of a timeout, not a test. Check (Linux) ran 16:32:33 to 16:57:38, against timeout-minutes: 25 (.github/workflows/ci.yml:118). Every step passed: 1090 lib tests, the 7 voice_isolation tests, types and frontend. The run restored no cache, and its test build took 10m29s against 6m32s in #844's run at the same time; tract at opt-level 3 is most of that.
  2. The build needs curl and network access now (inline on Cargo.toml).
  3. The ARM64 image shows a switch that does nothing (inline).

Not built or run here.

// Voice isolation properties
// ============================================================
exposed_properties.push(ExposedProperty {
name: format!("ch{}_voice_isolation", ch),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property is exposed whether or not the feature is compiled in, and the frontend toggle is unconditional too (frontend/src/mixer/detail.rs). The ARM64 Docker image is built without default features (Dockerfile:231: --no-default-features --features no-gui,efp), so it has no voiceiso_N element. On that image the switch is shown but does nothing. At build time it only warn!s (mixer/voice_isolation.rs:38). A live toggle should fail with ElementNotFound from update_element_property (backend/src/gst/pipeline/properties.rs:192-195). I have not traced the route from the block property to that function. Either add the feature to the ARM64 build, or leave these properties out when the feature is off (cfg!(feature = "voice-isolation")).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Claude, on behalf of @wagenet. Confirmed: Dockerfile:231 built ARM64 with --no-default-features --features no-gui,efp, so the image had no voiceiso_N element. Fixed in 357c04e by adding voice-isolation to that list (the builder image has curl). I did not trace the route to update_element_property, since the element now exists on that image. The ARM64 Docker build has not been run. #1102 rewrites the same line, so whichever lands second has to carry the feature across.

engine.process_hop(hop, &mut hop_out)?;
primed.extend_from_slice(&hop_out);
}
state.out = primed[MODEL_DELAY..].iter().copied().collect();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On enable, the priming keeps primed[MODEL_DELAY..]. The first wet samples are therefore the input from 60 ms ago, and they are crossfaded in over 10 ms against the current dry signal. So switching on replays the last 60 ms, and switching off (mix, line 405) skips 60 ms. That may be acceptable, but the body's "crossfades over 10 ms" suggests a seamless switch. Add it to Known limits so operators don't toggle it mid-sentence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Claude, on behalf of @wagenet. Confirmed: on enable the wet path starts 60 ms behind the dry one, so switching on replays the last 60 ms and switching off skips 60 ms, with a 10 ms crossfade over each. Added to Known limits in the PR body ("Avoid toggling mid-sentence"). No code change.

Comment thread backend/Cargo.toml
no-gui = []
# DPDFNet speech enhancement on mixer channels, run with tract (pure Rust).
# The model is downloaded at build time and embedded in the binary.
voice-isolation = ["dep:tract-onnx", "dep:realfft", "dep:byte-slice-cast"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is on by default, and with it every build runs curl against GitHub (backend/build.rs:428). docs/DEVELOPMENT.md's Optional Cargo Features table needs a row for it, saying it needs curl and network access, or STROM_VOICE_ISOLATION_MODEL for offline builds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Claude, on behalf of @wagenet. Added a voice-isolation row to the Optional Cargo Features table in docs/DEVELOPMENT.md (357c04e). It says it needs curl and network access, or STROM_VOICE_ISOLATION_MODEL for offline builds.

wagenet and others added 4 commits November 19, 2026 07:36
Adds stromvoiceisolation, a native element that runs the DPDFNet speech
enhancement model (DPDFNet-2, 48 kHz, Apache-2.0) through onnxruntime, and
puts it in every mixer channel between the HPF and the gate. Off by default;
switching it on or off while the flow runs crossfades over 10 ms.

The element reports no latency: Strom never recalculates pipeline latency,
so reporting the model's delay would hold back every channel. Audio on an
enabled channel is instead 60 ms late within unchanged timestamps.

The model is downloaded and checksummed at build time and compiled into
the binary; onnxruntime is linked statically from the ort prebuilts. Both
sit behind the default `voice-isolation` feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ort prebuilt onnxruntime needs libstdc++ and glibc 2.38 symbols, so
the zigbuild Linux release builds (glibc 2.31, libc++) cannot link it.
tract is pure Rust and builds on every target. Debug builds optimise the
tract and FFT crates, since unoptimised inference cannot keep up with
live audio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The disabled test now runs for 3 s, long enough for a model load that
should never start. The odd-buffer test runs at a 0 dB limit, where the
wet signal is the input itself, and checks every output sample against
the input exactly CONTENT_DELAY_SAMPLES earlier, so running short of wet
samples fails it. The element and engine use the shared
VOICE_ISOLATION_NO_LIMIT_DB instead of a literal 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The disabled test ran for a fixed 3 s, and a slow CI host can take longer
than that to load the model, so an element ignoring `enabled` could pass.
An enabled element fed the same audio now marks when a load completes on
this host, and the check runs until one second after that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wagenet and others added 3 commits November 19, 2026 07:36
tract's ONNX GRUs carry their final hidden state into the next run of a
session instead of starting from initial_h. DPDFNet's intra GRUs run
across frequency within one frame, so the engine's long-lived session
started every frame's GRUs from the previous frame's and the recurrent
state drifted: real speech came out 40-90 dB down, and Engine::reset
could not clear it.

Run each hop through SimplePlan::run, which spawns a session per call.
On recorded guest speech the output now matches onnxruntime (sherpa-onnx's
reference wrapper) within 1 dB per 5 s window.
Costs about 0.13 ms per 10 ms hop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ARM64 Docker build passes --no-default-features, so the mixer
exposed a voice isolation switch with no element behind it. Add the
feature to that list. List it in the Optional Cargo Features table,
with the curl and network need and the offline override.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Upstream added ExposedProperty.visible_when; the two voice isolation
properties need it. Cargo.lock is regenerated after the rebase.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wagenet
wagenet force-pushed the wagenet/mixer-voice-isolation branch from c77f192 to 1c7ef06 Compare November 19, 2026 17:50
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.

2 participants