D3D12 runtime: audio DSP mono convolutions, so TVs, phone calls and reverb are heard #2604

Manually merged
github merged 1 commit from github-bot/gh-2604 into main 2026-11-29 19:04:13 +00:00 AGit
Owner

@⁠ItsYusei99 on GitHub · 2026-11-29 04:25 UTC · original
ItsYusei99:audio-dsp-convolve → main · +311 −8 · 2 files · 1 commits · merged 2026-11-29 19:00 UTC

Related: #2363 (the same DSP in the Vulkan runtime's runtime/shims/xapu_chad.cpp; this one is the D3D12 runtime's d3d12/crates/leonida-hle, no file in common)

What and why

In the D3D12 runtime the audio DSP (chad.dll, modules/dsp.rs) answered every stream with zeros. The title sends the sound of speakers in the world (TVs, phone calls) through the DSP alone, and its reverb sends through it too, so those were silent and reverb was dry.

This ports trustno1-coder/VIctory-NVIDIA eca45ac ("Audio DSP: compute mono convolutions, so TVs, phone calls and reverb are heard", by Yve, GPL-3.0-or-later) and its clippy follow-up 9b712a6, with this tree's crate and variable names:

  • the impulse responses the title passes to XDspActivate are read as blocks of 2048 floats (the 2048-point FFT of a window of the response), and mono convolutions of 1024-frame blocks are computed (modules/dsp/convolve.rs, new);
  • stereo and 512-frame convolutions and the other transforms still give zeros;
  • LEONIDA_DSP_CONVOLVE=0 turns it off; LEONIDA_DSP_GAIN scales it (default 2, as upstream: the hardware's scaling is not known).

This tree's dsp.rs was byte for byte the upstream file before eca45ac (after the victory→leonida renames), so the port is the upstream file as it is now. The original author is credited with a Co-Authored-By line.

Tested

  • cargo test --locked -p leonida-hle --lib dsp: 4 passed (a_mono_convolution_is_computed, convolution_stream_as_the_title_drives_it, convolve::a_silent_ring_gives_silence, convolve::matches_a_direct_convolution_across_blocks).
  • cargo build --locked --profile diag -p leonida --features diagnostics,dlss,mimalloc builds, and the title runs with it (Series S profile, DLSS + frame generation 2x). Whether TVs and phone calls are heard has not been listened for in a run yet.

GPUs tested: NVIDIA GeForce RTX 4070 12 GB, driver 621.40, Windows 11 Pro 26200

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md (n/a: no translator change).

🤖 Generated with Claude Code

**@⁠ItsYusei99** on GitHub · 2026-11-29 04:25 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2604) `ItsYusei99:audio-dsp-convolve` → `main` · +311 −8 · 2 files · 1 commits · merged 2026-11-29 19:00 UTC Related: #2363 (the same DSP in the Vulkan runtime's `runtime/shims/xapu_chad.cpp`; this one is the D3D12 runtime's `d3d12/crates/leonida-hle`, no file in common) ### What and why In the D3D12 runtime the audio DSP (`chad.dll`, `modules/dsp.rs`) answered every stream with zeros. The title sends the sound of speakers in the world (TVs, phone calls) through the DSP alone, and its reverb sends through it too, so those were silent and reverb was dry. This ports trustno1-coder/VIctory-NVIDIA `eca45ac` ("Audio DSP: compute mono convolutions, so TVs, phone calls and reverb are heard", by Yve, GPL-3.0-or-later) and its clippy follow-up `9b712a6`, with this tree's crate and variable names: - the impulse responses the title passes to `XDspActivate` are read as blocks of 2048 floats (the 2048-point FFT of a window of the response), and mono convolutions of 1024-frame blocks are computed (`modules/dsp/convolve.rs`, new); - stereo and 512-frame convolutions and the other transforms still give zeros; - `LEONIDA_DSP_CONVOLVE=0` turns it off; `LEONIDA_DSP_GAIN` scales it (default 2, as upstream: the hardware's scaling is not known). This tree's `dsp.rs` was byte for byte the upstream file before `eca45ac` (after the victory→leonida renames), so the port is the upstream file as it is now. The original author is credited with a `Co-Authored-By` line. ### Tested - `cargo test --locked -p leonida-hle --lib dsp`: 4 passed (`a_mono_convolution_is_computed`, `convolution_stream_as_the_title_drives_it`, `convolve::a_silent_ring_gives_silence`, `convolve::matches_a_direct_convolution_across_blocks`). - `cargo build --locked --profile diag -p leonida --features diagnostics,dlss,mimalloc` builds, and the title runs with it (Series S profile, DLSS + frame generation 2x). Whether TVs and phone calls are heard has not been listened for in a run yet. GPUs tested: NVIDIA GeForce RTX 4070 12 GB, driver 621.40, Windows 11 Pro 26200 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md` (n/a: no translator change). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title sends the sound of speakers in the world (TVs, phone calls) through
the audio DSP alone, and its reverb sends through it too. The DSP's outputs
were zeros, so those were silent and reverb was dry.

From trustno1-coder/VIctory-NVIDIA eca45ac (GPL-3.0-or-later) (Audio DSP: compute mono
convolutions, by Yve) and 9b712a6 (its clippy fix), with the crate and
variable names of this tree: mono convolutions of 1024-frame blocks are
computed from the impulse responses the title passes to XDspActivate; stereo
and 512-frame convolutions and the other transforms still give zeros.
LEONIDA_DSP_CONVOLVE=0 turns it off; LEONIDA_DSP_GAIN scales it (default 2).

This tree's dsp.rs was the file as it was before that commit (identical after
the renames), so the port is the upstream file as it is now.

Co-Authored-By: Yve <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 04:27:23 +00:00
Author
Owner

@⁠TheGeogeo on GitHub · 2026-11-29 04:53 UTC · original

Tested 0ede2aa79 merged (no commit) with main ef3299584: Windows 11 10.0.26300, Rust 1.98.1, CPU only (host-side unit tests).

  • Green: cargo test -p leonida-hle --lib --locked --offline gives 214 passed, 0 failed, 2 ignored. Plain main gives 211 passed, 2 ignored. The 3 new tests pass: a_mono_convolution_is_computed, convolve::a_silent_ring_gives_silence and convolve::matches_a_direct_convolution_across_blocks.
  • Red: with LEONIDA_DSP_CONVOLVE=0 (the PR's own switch back to the old zero output), a_mono_convolution_is_computed fails with sample 3: 0 vs 0.14285715. The two convolve:: tests cover the new module, which has no main counterpart.
  • Clippy on leonida-hle: the same 9 warning sites on main and on the merge, none in modules/dsp. I compared without -D warnings, which stops in leonida-lua, a crate this PR does not touch.
  • cargo fmt --check flags most of the d3d12/ tree, so it says nothing about this PR.
  • tests/test_docs_env_vars.py passes on both, and check_no_game_data.py is clean.
  • Not checked: whether TVs and phone calls are heard in a run (no game run here).

No blocker from my side. AI-assisted (Claude Code).

**@⁠TheGeogeo** on GitHub · 2026-11-29 04:53 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2604#issuecomment-7250921476) Tested `0ede2aa79` merged (no commit) with `main` `ef3299584`: Windows 11 10.0.26300, Rust 1.98.1, CPU only (host-side unit tests). - Green: `cargo test -p leonida-hle --lib --locked --offline` gives 214 passed, 0 failed, 2 ignored. Plain `main` gives 211 passed, 2 ignored. The 3 new tests pass: `a_mono_convolution_is_computed`, `convolve::a_silent_ring_gives_silence` and `convolve::matches_a_direct_convolution_across_blocks`. - Red: with `LEONIDA_DSP_CONVOLVE=0` (the PR's own switch back to the old zero output), `a_mono_convolution_is_computed` fails with `sample 3: 0 vs 0.14285715`. The two `convolve::` tests cover the new module, which has no `main` counterpart. - Clippy on `leonida-hle`: the same 9 warning sites on `main` and on the merge, none in `modules/dsp`. I compared without `-D warnings`, which stops in `leonida-lua`, a crate this PR does not touch. - `cargo fmt --check` flags most of the `d3d12/` tree, so it says nothing about this PR. - `tests/test_docs_env_vars.py` passes on both, and `check_no_game_data.py` is clean. - Not checked: whether TVs and phone calls are heard in a run (no game run here). No blocker from my side. AI-assisted (Claude Code).
Author
Owner

@⁠kurrutako on GitHub · 2026-11-29 10:27 UTC · original

Game run on Windows 11, RTX 5070 12 GB, NVIDIA 621.01: phone calls are heard with this PR and were silent without it.

  • A: main eb4773b34, d3d12\scripts\play-d3d12.ps1 defaults (Series X profile, the title's own upscaler, DLSS frame generation 2x), diag build with diagnostics,dlss,mimalloc. Phone calls in the story had no voice from the other end.
  • B: the same build with 0ede2aa79 applied (its two files, dsp.rs and dsp/convolve.rs), same settings and save. The log shows audio DSP connected ... max_channels=1, and the caller's voice is heard in phone calls.
  • Both builds also carry two local changes that do not touch the DSP: extra logging in xgamesave.rs, and a LEONIDA_HEAP_RECHECK_FRAMES switch in leonida-gpu's draw.rs (not set in these runs).
  • The A and B runs were played by ear and are not the same scene, so this says nothing about level or timing beyond "heard / not heard".

Not tested: TVs and other world speakers, reverb, whether LEONIDA_DSP_GAIN=2 matches the console's level, LEONIDA_DSP_CONVOLVE=0, Linux/Wine.

AI-assisted (Claude Code).

**@⁠kurrutako** on GitHub · 2026-11-29 10:27 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2604#issuecomment-7254450622) Game run on Windows 11, RTX 5070 12 GB, NVIDIA 621.01: phone calls are heard with this PR and were silent without it. - **A:** `main` `eb4773b34`, `d3d12\scripts\play-d3d12.ps1` defaults (Series X profile, the title's own upscaler, DLSS frame generation 2x), diag build with `diagnostics,dlss,mimalloc`. Phone calls in the story had no voice from the other end. - **B:** the same build with `0ede2aa79` applied (its two files, `dsp.rs` and `dsp/convolve.rs`), same settings and save. The log shows `audio DSP connected ... max_channels=1`, and the caller's voice is heard in phone calls. - Both builds also carry two local changes that do not touch the DSP: extra logging in `xgamesave.rs`, and a `LEONIDA_HEAP_RECHECK_FRAMES` switch in `leonida-gpu`'s `draw.rs` (not set in these runs). - The A and B runs were played by ear and are not the same scene, so this says nothing about level or timing beyond "heard / not heard". Not tested: TVs and other world speakers, reverb, whether `LEONIDA_DSP_GAIN=2` matches the console's level, `LEONIDA_DSP_CONVOLVE=0`, Linux/Wine. AI-assisted (Claude Code).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 13:08 UTC · original

Independent convolution check for 0ede2aa79 merged on 3535eb5c4, using the Windows x64 HLE library under Wine 11.22. I fed three synthetic signals through XDspActivate and XDspSubmitCommand. I packed the IR windows separately with NumPy and compared the outputs to direct double-precision convolution with the omitted Nyquist term accounted for. The 80 blocks include boundary impulses, a multi-block tail through silence and an alternating signal. The default gain matched all 81,920 samples to within 2.39e-7 absolute error. Gain 0.375 matched to within 4.5e-8. Gain 0 and LEONIDA_DSP_CONVOLVE=0 gave exact silence. Unmodified main also produced silence for the same inputs. The four existing DSP tests passed. The full Wine suite showed the same three non-DSP failures on both revisions.

One configuration edge case: LEONIDA_DSP_GAIN=NaN and LEONIDA_DSP_GAIN=inf are accepted by the float parser. Each produced 52,224 non-finite samples across the fixture. Filtering the parsed value with .filter(|v: &f32| v.is_finite()) in gain() made both inputs fall back to the default waveform in a local retest. Finite custom gain, zero and the explicit off switch still passed with that guard. Synthetic inputs only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 13:08 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2604#issuecomment-7256324156) Independent convolution check for `0ede2aa79` merged on `3535eb5c4`, using the Windows x64 HLE library under Wine 11.22. I fed three synthetic signals through `XDspActivate` and `XDspSubmitCommand`. I packed the IR windows separately with NumPy and compared the outputs to direct double-precision convolution with the omitted Nyquist term accounted for. The 80 blocks include boundary impulses, a multi-block tail through silence and an alternating signal. The default gain matched all 81,920 samples to within `2.39e-7` absolute error. Gain `0.375` matched to within `4.5e-8`. Gain `0` and `LEONIDA_DSP_CONVOLVE=0` gave exact silence. Unmodified main also produced silence for the same inputs. The four existing DSP tests passed. The full Wine suite showed the same three non-DSP failures on both revisions. One configuration edge case: `LEONIDA_DSP_GAIN=NaN` and `LEONIDA_DSP_GAIN=inf` are accepted by the float parser. Each produced 52,224 non-finite samples across the fixture. Filtering the parsed value with `.filter(|v: &f32| v.is_finite())` in `gain()` made both inputs fall back to the default waveform in a local retest. Finite custom gain, zero and the explicit off switch still passed with that guard. Synthetic inputs only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠enlight3d on GitHub · 2026-11-29 18:35 UTC · original

RUN: PR #2604 (audio DSP mono convolutions)

Heads: PR 0ede2aa79, main eedd72e30 (current origin/main at the time). Merged locally with git merge --no-ff (clean, dsp.rs and the new dsp/convolve.rs, nothing pushed). No conflict with #2566.

Command (d3d12/, MSVC target, vcvars64): cargo test -j 6 -p leonida-hle --lib, cargo check -j 6 -p leonida-hle --tests.

  • RED (behavioural, via the PR's own off switch, no code reverted: LEONIDA_DSP_CONVOLVE=0, which gives the old silent output; cargo test -p leonida-hle --lib dsp::): a_mono_convolution_is_computed FAILED at dsp.rs:380 (sample 3: 0 vs 0.14285715). The other three dsp tests pass. (The tests and the code sit in the same files, so reverting only the non-test code is a build failure.)
  • GREEN (merged tree): --lib 218 passed, 0 failed, 2 ignored (the 3 new tests: a_mono_convolution_is_computed, matches_a_direct_convolution_across_blocks, a_silent_ring_gives_silence, all ok). Plain main: 215 passed, 0 failed, 2 ignored.
  • cargo check -p leonida-hle --tests on the merged tree: clean.

Not checked: how it sounds in the game, and the 2.0 gain (set by ear in the PR).

Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 (native target).

**@⁠enlight3d** on GitHub · 2026-11-29 18:35 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2604#issuecomment-7260607168) RUN: PR #2604 (audio DSP mono convolutions) Heads: PR 0ede2aa79, main eedd72e30 (current origin/main at the time). Merged locally with `git merge --no-ff` (clean, `dsp.rs` and the new `dsp/convolve.rs`, nothing pushed). No conflict with #2566. Command (d3d12/, MSVC target, vcvars64): `cargo test -j 6 -p leonida-hle --lib`, `cargo check -j 6 -p leonida-hle --tests`. - RED (behavioural, via the PR's own off switch, no code reverted: `LEONIDA_DSP_CONVOLVE=0`, which gives the old silent output; `cargo test -p leonida-hle --lib dsp::`): `a_mono_convolution_is_computed` FAILED at `dsp.rs:380` (sample 3: 0 vs 0.14285715). The other three dsp tests pass. (The tests and the code sit in the same files, so reverting only the non-test code is a build failure.) - GREEN (merged tree): `--lib` 218 passed, 0 failed, 2 ignored (the 3 new tests: `a_mono_convolution_is_computed`, `matches_a_direct_convolution_across_blocks`, `a_silent_ring_gives_silence`, all ok). Plain main: 215 passed, 0 failed, 2 ignored. - `cargo check -p leonida-hle --tests` on the merged tree: clean. Not checked: how it sounds in the game, and the 2.0 gain (set by ear in the PR). Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 (native target).
github manually merged commit a09d1627e3 into main 2026-11-29 19:04:13 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-29 19:00 UTC · original

Merging. Head 0ede2aa79 has red/green verdicts from reviewers other than the author (above), merges cleanly with main 38e5ee7e8, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-tests mesh, semantic-tests f16) are pre-existing. Merged by MoonEyes.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-11-29 19:00 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2604#issuecomment-7260925007) Merging. Head `0ede2aa79` has red/green verdicts from reviewers other than the author (above), merges cleanly with `main` `38e5ee7e8`, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (`translator-tests` mesh, `semantic-tests` f16) are pre-existing. Merged by MoonEyes. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2604
No description provided.