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

Manually merged
github merged 1 commit from github-bot/gh-77 into main 2026-11-27 20:09:59 +00:00 AGit
Owner

@⁠Omnicrash on GitHub · 2026-11-27 16:54 UTC · original
Omnicrash:dsp-convolution → main · +311 −8 · 2 files · 1 commits · merged 2026-11-27 20:07 UTC

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.
**@⁠Omnicrash** on GitHub · 2026-11-27 16:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/77) `Omnicrash:dsp-convolution` → `main` · +311 −8 · 2 files · 1 commits · merged 2026-11-27 20:07 UTC 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.
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 (fxceless/victory-fork#1470).

The impulse responses the title passes to XDspActivate are blocks of 2048
floats: the unscaled 2048-point FFT of a 2048-sample window of the response,
window k covering samples (k-1)*1024..(k+1)*1024, bins 0-1023 interleaved
re/im, then a schedule block that starts with 0xFFFFACE1. Every block of the
title's responses matches its neighbours under that reading. An input block
zero-padded to 2048 samples times window k gives that block's part of the
output k blocks later, in the second half of the inverse FFT.

All the streams the title opened in a session with TVs, a phone call and
reverb were mono convolutions of 1024-frame blocks; those are computed now.
Stereo and 512-frame convolutions and the other transforms still give zeros.
VICTORY_DSP_CONVOLVE=0 turns it off; VICTORY_DSP_GAIN scales it (default 2:
the hardware's scaling is not known, and 1/2048 alone sounded quiet).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 16:59:33 +00:00
Author
Owner

@⁠IdecEddy on GitHub · 2026-11-27 18:57 UTC · original

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

**@⁠IdecEddy** on GitHub · 2026-11-27 18:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/77#issuecomment-7226042450) 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
github manually merged commit be2e203c76 into main 2026-11-27 20:09:59 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.