Audio DSP: compute mono convolutions, so TVs, phone calls and reverb are heard #77

Merged
Omnicrash merged 1 commit from upstream-pr/77 into main 2026-11-27 20:07:59 +00:00
Omnicrash commented 2026-11-27 16:54:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Omnicrash on 2026-11-27T16:54:13Z.


The title sends the sound of speakers in the world (TVs, phone calls) through the audio DSP (chad.dll) alone, and its reverb sends go through it too. The DSP's outputs were zeros, so TVs and phone calls were silent and reverb was dry. This computes the DSP's mono convolutions on the CPU. The same fix as fxceless/victory-fork#1491 (fxceless/victory-fork#1470): the DSP code here is the same file.

What is in it

  • crates/victory-hle/src/modules/dsp/convolve.rs: a uniformly partitioned FFT convolution that reads the title's impulse responses in the coprocessor's layout: blocks of 2048 floats, each the unscaled 2048-point FFT of a 2048-sample window of the response (window k covers samples (k-1)*1024 .. (k+1)*1024), bins 0-1023 interleaved re/im, then a schedule block that starts with 0xFFFFACE1. I read the layout from the responses the retail title passes to XDspActivate: under that reading, the time-domain halves of every pair of neighbouring blocks match, across all 21 responses dumped. Streams whose inputs have been silent for a whole response cost nothing.
  • crates/victory-hle/src/modules/dsp.rs: mono convolution streams of 1024-frame blocks get a convolver at activation; XDspSubmitCommand writes the convolution instead of zeros. VICTORY_DSP_CONVOLVE=0 turns it off. VICTORY_DSP_GAIN scales the output (default 2, see below).
  • Tests: a sample-by-sample comparison with a direct convolution across five blocks, a silent ring giving silence, and a mono stream driven through XDspActivate / XDspSubmitCommand.

Tested

  • RTX 3090, Windows, Rust 1.98.1, release build (LTO, x86-64-v3), Series X profile, in the open world, a TV indoors and a phone call
  • In one session the title opened 127 DSP streams, all kind=1, mono, 1024 frames, responses of 19 to 103 windows. All of them were computed (computed=true in the debug log). TVs and phone calls are heard, with their speaker colouring, and reverb comes back.
  • cargo test --locked -p victory-hle --lib: 174 passed, 0 failed, 2 ignored (on this repo's main with the commit on top)

Not tested

  • The level. How the hardware scales its result is not known. With the textbook 1/2048 of the inverse FFT, TVs and phone calls sounded quiet next to the rest of the mix, so the default is 2x, picked by ear at a TV. The same factor raises every reverb in the game, because both go through the same DSP streams. I have not checked the reverb level inside buildings or under bridges against dialogue and music at 2x; it may come out too strong. VICTORY_DSP_GAIN changes it without a rebuild.
  • Stereo convolutions, 512-frame blocks and the other block transform (kind 2): the title did not use them, and they still give zeros.
  • AMD and Intel GPUs (the change is CPU-side only), and the CPU cost on slower CPUs (up to about 100k complex multiply-adds per stream block for the longest responses).

AI use

  • Claude Code with Claude Opus 5.5: found the cause, worked out the layout from the dumps, wrote the code, the tests and this description. I listened to the result in game.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5530244077 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/77). Originally posted by [Omnicrash](https://github.com/Omnicrash) on 2026-11-27T16:54:13Z. --- The title sends the sound of speakers in the world (TVs, phone calls) through the audio DSP (`chad.dll`) alone, and its reverb sends go through it too. The DSP's outputs were zeros, so TVs and phone calls were silent and reverb was dry. This computes the DSP's mono convolutions on the CPU. The same fix as fxceless/victory-fork#1491 (fxceless/victory-fork#1470): the DSP code here is the same file. **What is in it** - `crates/victory-hle/src/modules/dsp/convolve.rs`: a uniformly partitioned FFT convolution that reads the title's impulse responses in the coprocessor's layout: blocks of 2048 floats, each the unscaled 2048-point FFT of a 2048-sample window of the response (window k covers samples (k-1)\*1024 .. (k+1)\*1024), bins 0-1023 interleaved re/im, then a schedule block that starts with `0xFFFFACE1`. I read the layout from the responses the retail title passes to `XDspActivate`: under that reading, the time-domain halves of every pair of neighbouring blocks match, across all 21 responses dumped. Streams whose inputs have been silent for a whole response cost nothing. - `crates/victory-hle/src/modules/dsp.rs`: mono convolution streams of 1024-frame blocks get a convolver at activation; `XDspSubmitCommand` writes the convolution instead of zeros. `VICTORY_DSP_CONVOLVE=0` turns it off. `VICTORY_DSP_GAIN` scales the output (default 2, see below). - Tests: a sample-by-sample comparison with a direct convolution across five blocks, a silent ring giving silence, and a mono stream driven through `XDspActivate` / `XDspSubmitCommand`. **Tested** - RTX 3090, Windows, Rust 1.98.1, release build (LTO, x86-64-v3), Series X profile, in the open world, a TV indoors and a phone call - In one session the title opened 127 DSP streams, all `kind=1`, mono, 1024 frames, responses of 19 to 103 windows. All of them were computed (`computed=true` in the debug log). TVs and phone calls are heard, with their speaker colouring, and reverb comes back. - `cargo test --locked -p victory-hle --lib`: 174 passed, 0 failed, 2 ignored (on this repo's main with the commit on top) **Not tested** - **The level.** How the hardware scales its result is not known. With the textbook 1/2048 of the inverse FFT, TVs and phone calls sounded quiet next to the rest of the mix, so the default is 2x, picked by ear at a TV. The same factor raises every reverb in the game, because both go through the same DSP streams. I have not checked the reverb level inside buildings or under bridges against dialogue and music at 2x; it may come out too strong. `VICTORY_DSP_GAIN` changes it without a rebuild. - Stereo convolutions, 512-frame blocks and the other block transform (`kind` 2): the title did not use them, and they still give zeros. - AMD and Intel GPUs (the change is CPU-side only), and the CPU cost on slower CPUs (up to about 100k complex multiply-adds per stream block for the longest responses). **AI use** - Claude Code with Claude Opus 5.5: found the cause, worked out the layout from the dumps, wrote the code, the tests and this description. I listened to the result in game.
IdecEddy commented 2026-11-27 18:57:25 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IdecEddy on 2026-11-27T18:57:25Z.


Works on my PC

Processor AMD Ryzen 9 9950X3D 16-Core Processor (4.30 GHz)
Installed RAM 128 GB (126 GB usable)
Graphics card NVIDIA GeForce RTX 2080 SUPER (8 GB)
AMD Radeon(TM) Graphics (2 GB)
System type 64-bit operating system, x64-based processor

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7226042450 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/77#issuecomment-7226042450). Originally posted by [IdecEddy](https://github.com/IdecEddy) on 2026-11-27T18:57:25Z. --- Works on my PC Processor AMD Ryzen 9 9950X3D 16-Core Processor (4.30 GHz) Installed RAM 128 GB (126 GB usable) Graphics card NVIDIA GeForce RTX 2080 SUPER (8 GB) AMD Radeon(TM) Graphics (2 GB) System type 64-bit operating system, x64-based processor
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!77
No description provided.