[CLAIM] VSP-17: host-side partitioned convolution for audio DSP streams (dsp.rs) #21

Open
opened 2026-11-30 17:48:45 +00:00 by github-bot · 0 comments
Owner

@⁠thefafu on GitHub · 2026-11-30 17:48 UTC · original

Roadmap Task ID

VSP-17

Technical Plan & File Scope

File: crates/vesper-hle/src/modules/dsp.rs only (unit tests in the same file). Fixes #6.

Plan:

  • Activation: read the impulse response the title hands to XDspActivate with a checked copy, so an unreadable pointer refuses the filter instead of faulting. The IR is in the coprocessor's partitioned frequency-domain layout:

    • per partition, frames complex bins of a 2 * frames FFT, without the Nyquist bin;
    • a stereo IR (option 8) has one run per channel;
    • the IR ends in a closing partition whose first word is not a finite float.

    Each partition's time slice is rebuilt and kept as a spectrum.

  • Submit: uniformly partitioned overlap-add convolution per channel, with the command's gain ramp. Blocks can be interleaved or deinterleaved (option 2). The input is copied first, so blocks processed in place work. Non-finite samples become 0, and the output is held to [-1, 1].

  • No audio-thread stalls:

    • Every buffer (filter, input-history ring, FFT scratch, twiddles) is allocated at activation. A command does no allocation and takes no lock.
    • Only the frames + 1 unique bins are multiplied, in split real/imaginary runs that vectorize.
    • A long filter is built one partition per block (partition k is first needed k blocks in), so activation does not stall either.
    • Commands still complete synchronously, so the status block never reports an overrun.
  • Fallback: a convolution stream whose filter is unusable passes its input through with the command's gains instead of going silent. VESPER_DSP_CONVOLUTION=0 does the same for every stream. FFT/IFFT transform streams stay silent as today.

  • Basis: a GPL-3.0-or-later host convolution from the lineage this project descends from (used in other forks to restore these voices), reworked as described above.

Verification:

  • Unit tests: a direct time-domain convolution reference over several blocks, the console IR layout with its closing partition, stereo filters in both layouts, the gain ramp, refused layouts, an IR longer than the connection block played through the API in place, and the passthrough fallback.
  • cargo xtask policy, cargo xtask test-fast, cargo test -p xtask --locked, cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings, cargo test --workspace --locked -- --test-threads=1.
  • A release measurement of one block with the longest filter a connection allows.
  • In game: a phone call with the caller's voice audible, plus a Series X 1440p native telemetry run (scripts\launch.cmd [1]) before/after.

Implemented with an AI coding tool (Claude Code); disclosed in the PR.

Contributor Rules

  • I confirmed this task is Open, not held by another claim, and outside the Maintainer Active Queue.
  • I will include local xtask + clippy + test results and real before/after telemetry in my PR.
**@⁠thefafu** on GitHub · 2026-11-30 17:48 UTC · [original](https://github.com/monte-alt/vesper/issues/21) ### Roadmap Task ID VSP-17 ### Technical Plan & File Scope File: `crates/vesper-hle/src/modules/dsp.rs` only (unit tests in the same file). Fixes #6. Plan: - **Activation:** read the impulse response the title hands to `XDspActivate` with a checked copy, so an unreadable pointer refuses the filter instead of faulting. The IR is in the coprocessor's partitioned frequency-domain layout: - per partition, `frames` complex bins of a `2 * frames` FFT, without the Nyquist bin; - a stereo IR (option 8) has one run per channel; - the IR ends in a closing partition whose first word is not a finite float. Each partition's time slice is rebuilt and kept as a spectrum. - **Submit:** uniformly partitioned overlap-add convolution per channel, with the command's gain ramp. Blocks can be interleaved or deinterleaved (option 2). The input is copied first, so blocks processed in place work. Non-finite samples become 0, and the output is held to [-1, 1]. - **No audio-thread stalls:** - Every buffer (filter, input-history ring, FFT scratch, twiddles) is allocated at activation. A command does no allocation and takes no lock. - Only the `frames + 1` unique bins are multiplied, in split real/imaginary runs that vectorize. - A long filter is built one partition per block (partition k is first needed k blocks in), so activation does not stall either. - Commands still complete synchronously, so the status block never reports an overrun. - **Fallback:** a convolution stream whose filter is unusable passes its input through with the command's gains instead of going silent. `VESPER_DSP_CONVOLUTION=0` does the same for every stream. FFT/IFFT transform streams stay silent as today. - **Basis:** a GPL-3.0-or-later host convolution from the lineage this project descends from (used in other forks to restore these voices), reworked as described above. Verification: - Unit tests: a direct time-domain convolution reference over several blocks, the console IR layout with its closing partition, stereo filters in both layouts, the gain ramp, refused layouts, an IR longer than the connection block played through the API in place, and the passthrough fallback. - `cargo xtask policy`, `cargo xtask test-fast`, `cargo test -p xtask --locked`, `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings`, `cargo test --workspace --locked -- --test-threads=1`. - A release measurement of one block with the longest filter a connection allows. - In game: a phone call with the caller's voice audible, plus a Series X 1440p native telemetry run (`scripts\launch.cmd` [1]) before/after. Implemented with an AI coding tool (Claude Code); disclosed in the PR. ### Contributor Rules - [x] I confirmed this task is Open, not held by another claim, and outside the Maintainer Active Queue. - [x] I will include local xtask + clippy + test results and real before/after telemetry in my PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 17:48:45 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.