WIP: feat(audio): the game's reverb, delay and biquad filter effects on its sub mixes #1644

Draft
TrashPanda wants to merge 3 commits from TrashPanda/Longshot:feat/audio-effects into main
Contributor

Type: feat · Risk: medium · Tested on: not run in the game (game-free checks only, Linux) · Needs: Windows and Linux, any GPU: a listen in caves and halls

Needs testing in the game. This was opened without a run in the game, at the request of the person I work for: the code is built and its game-free test passes, but nobody has heard it yet. Please try it and say what you heard (see Must be tested).

TL;DR

The game puts reverb, echo and filters on its sound in places like caves, temples and big halls, but Longshot never answered those requests, so everything sounded dry. This PR adds the game's standard reverb, its delay (echo) and its filter on the sub mixes, as the console does. A game-free test runs the effects on made-up sound and passes; nobody has listened to it in the game yet.

Breakdown

  • Who it helps: everyone: caves, dungeons and large rooms get their echo back.
  • What was wrong: the game's calls that add a reverb, a delay or a biquad filter to a mix went unanswered, so the mix stayed dry.
  • What changes: those effects run on the mixes the game adds them to, in the order it adds them, with the reverbs and Aux effects already there.
  • What does not change: the voices, the volume row, the output layouts; HOS_AUDIO_NO_EFFECTS=1 gives the dry sound of main back.
  • How it was checked: tests/test_audio_effects.py compiles the real code around authored samples and passes with gcc and clang; not run in the game.
  • What is still open: a listen in the game on Windows and Linux, and a look at the audio thread's cost.
  • Risk: medium: wrong gains could be too loud, clip or sound wrong in some rooms; the switch turns it all off.

Why

The game asks for reverb, delay and biquad filter effects on its sub mixes, and Longshot left those calls unanswered: rooms that should echo (Dodongo's Cavern, the Deku Tree, the Temple of Time) sounded flat. Fixes #123.

What changed

The nn::audio effect calls the game makes now do what they do on the console. Ported from Hookshot's 0c1a6d0a and f31d77b2 by Mooseca, with Longshot's names.

  • audio (host/nn_audio.c): AddReverb and its setters run through the I3DL2 reverb's network with linear gains (the early mode spacing the reflections, the late mode sizing the lines); AddDelay is a delay line per channel with feedback, channel spread and a low pass; AddBiquadFilter runs the voices' filter on a mix's buffers (mix_biquad_block). They run with the reverbs and Aux effects in the order the game added them, each with a handle kind of its own. GetAudioDeviceOutputVolume and the voice drop parameter answer floats.
  • switches (gpu/vk/switches.def, docs/development.md): HOS_AUDIO_NO_EFFECTS is new; HOS_AUDIO_NO_REVERB was there and now gets its line in the docs.
  • tests: tests/test_audio_effects.py with tests/audio_effects_test.c.

Measurements

Verdict: not measured yet: nothing has run in the game. The audio thread's cost with the effects on is the number to take (see Must be tested).

Flags and settings

One new switch, HOS_AUDIO_NO_EFFECTS, for comparing only; HOS_AUDIO_NO_REVERB was already there.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
HOS_AUDIO_NO_EFFECTS every effect on the mixes skipped (none) unset: effects on =1: the dry sound, as main untested unset; only to compare
HOS_AUDIO_NO_REVERB the reverbs skipped unset: reverb on unset: reverb on =1: no reverb untested unset; only to compare

Testing

Tested: python -I -B tests/test_audio_effects.py passes with gcc and clang (Linux): the reverb, delay and biquad filter on authored samples.

Not tested: anything in the game; the whole of tests/run_all.py (only the audio check was run, at the request of the person I work for).

Must be tested:

  • Windows and Linux, any GPU, stereo: inside the Deku Tree, Dodongo's Cavern and the Temple of Time, listen with this PR and again with HOS_AUDIO_NO_EFFECTS=1, expecting an echo with the PR and none with the switch, with no crackle, clipping or sudden loudness (by hand, or Test Farm: @Beanstalk a listen in the Deku Tree and Dodongo's Cavern).
  • 5.1 output (any OS): the same rooms, expecting the reverb on every speaker and nothing missing from the centre.
  • Any OS: longshot_log.txt after half an hour of play, expecting no audio warnings and no underruns that main doesn't have.

Risks

What could break: the sound in rooms the game adds effects to: too loud, clipped, or an echo that doesn't fit; the audio thread doing more work on a slow CPU.

Turning it off: HOS_AUDIO_NO_EFFECTS=1 (all effects) or HOS_AUDIO_NO_REVERB=1 (reverb only), or revert the commits.

Compatibility: Nothing changes: saves, longshot_options.ini, the shader and pipeline caches and the vk ABI are as they were.

Issues

Fixes #123

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. (not run in the game: opened untested on request; see Must be tested)
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. (the audio thread's cost is not measured yet)
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). (not run: only tests/test_audio_effects.py)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • Docs updated.
**Type:** feat · **Risk:** medium · **Tested on:** not run in the game (game-free checks only, Linux) · **Needs:** Windows and Linux, any GPU: a listen in caves and halls > **Needs testing in the game.** This was opened without a run in the game, at the request of the person I work for: the code is built and its game-free test passes, but nobody has heard it yet. Please try it and say what you heard (see Must be tested). ## TL;DR The game puts reverb, echo and filters on its sound in places like caves, temples and big halls, but Longshot never answered those requests, so everything sounded dry. This PR adds the game's standard reverb, its delay (echo) and its filter on the sub mixes, as the console does. A game-free test runs the effects on made-up sound and passes; nobody has listened to it in the game yet. ## Breakdown - **Who it helps:** everyone: caves, dungeons and large rooms get their echo back. - **What was wrong:** the game's calls that add a reverb, a delay or a biquad filter to a mix went unanswered, so the mix stayed dry. - **What changes:** those effects run on the mixes the game adds them to, in the order it adds them, with the reverbs and Aux effects already there. - **What does not change:** the voices, the volume row, the output layouts; `HOS_AUDIO_NO_EFFECTS=1` gives the dry sound of `main` back. - **How it was checked:** `tests/test_audio_effects.py` compiles the real code around authored samples and passes with gcc and clang; not run in the game. - **What is still open:** a listen in the game on Windows and Linux, and a look at the audio thread's cost. - **Risk:** medium: wrong gains could be too loud, clip or sound wrong in some rooms; the switch turns it all off. ## Why The game asks for reverb, delay and biquad filter effects on its sub mixes, and Longshot left those calls unanswered: rooms that should echo (Dodongo's Cavern, the Deku Tree, the Temple of Time) sounded flat. Fixes #123. ## What changed The `nn::audio` effect calls the game makes now do what they do on the console. Ported from Hookshot's [0c1a6d0a](https://git.notrexed.dev/Hookshot/Hookshot/commit/0c1a6d0ab4a8021593ea992bb2a6ab57d32775d0) and [f31d77b2](https://git.notrexed.dev/Hookshot/Hookshot/commit/f31d77b2c448d324448db6dfe00da358a3abda9f) by Mooseca, with Longshot's names. - audio (`host/nn_audio.c`): `AddReverb` and its setters run through the I3DL2 reverb's network with linear gains (the early mode spacing the reflections, the late mode sizing the lines); `AddDelay` is a delay line per channel with feedback, channel spread and a low pass; `AddBiquadFilter` runs the voices' filter on a mix's buffers (`mix_biquad_block`). They run with the reverbs and Aux effects in the order the game added them, each with a handle kind of its own. `GetAudioDeviceOutputVolume` and the voice drop parameter answer floats. - switches (`gpu/vk/switches.def`, `docs/development.md`): `HOS_AUDIO_NO_EFFECTS` is new; `HOS_AUDIO_NO_REVERB` was there and now gets its line in the docs. - tests: `tests/test_audio_effects.py` with `tests/audio_effects_test.c`. ## Measurements **Verdict:** not measured yet: nothing has run in the game. The audio thread's cost with the effects on is the number to take (see Must be tested). ### Flags and settings One new switch, `HOS_AUDIO_NO_EFFECTS`, for comparing only; `HOS_AUDIO_NO_REVERB` was already there. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `HOS_AUDIO_NO_EFFECTS` | every effect on the mixes skipped | (none) | unset: effects on | `=1`: the dry sound, as `main` | untested | unset; only to compare | | `HOS_AUDIO_NO_REVERB` | the reverbs skipped | unset: reverb on | unset: reverb on | `=1`: no reverb | untested | unset; only to compare | ## Testing **Tested:** `python -I -B tests/test_audio_effects.py` passes with gcc and clang (Linux): the reverb, delay and biquad filter on authored samples. **Not tested:** anything in the game; the whole of `tests/run_all.py` (only the audio check was run, at the request of the person I work for). **Must be tested:** - Windows and Linux, any GPU, stereo: inside the Deku Tree, Dodongo's Cavern and the Temple of Time, listen with this PR and again with `HOS_AUDIO_NO_EFFECTS=1`, expecting an echo with the PR and none with the switch, with no crackle, clipping or sudden loudness (by hand, or Test Farm: @Beanstalk a listen in the Deku Tree and Dodongo's Cavern). - 5.1 output (any OS): the same rooms, expecting the reverb on every speaker and nothing missing from the centre. - Any OS: `longshot_log.txt` after half an hour of play, expecting no audio warnings and no underruns that `main` doesn't have. ## Risks **What could break:** the sound in rooms the game adds effects to: too loud, clipped, or an echo that doesn't fit; the audio thread doing more work on a slow CPU. **Turning it off:** `HOS_AUDIO_NO_EFFECTS=1` (all effects) or `HOS_AUDIO_NO_REVERB=1` (reverb only), or revert the commits. **Compatibility:** Nothing changes: saves, `longshot_options.ini`, the shader and pipeline caches and the vk ABI are as they were. ## Issues Fixes #123 ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [ ] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. *(not run in the game: opened untested on request; see Must be tested)* - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [ ] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. *(the audio thread's cost is not measured yet)* - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). *(not run: only `tests/test_audio_effects.py`)* - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] Docs updated.
The game adds a standard reverb, a delay and a biquad filter on its sub mixes; these imports were unanswered, so the mix
was dry. AddReverb and its setters run through the I3DL2 reverb's network with linear gains (the early mode spacing the
reflections, the late mode sizing the lines); AddDelay is a delay line per channel with feedback, channel spread and a low
pass; AddBiquadFilter runs the voices' filter on a mix's buffers. They run with the reverbs and Aux effects in the order the
game added them, each with a handle kind of its own. GetAudioDeviceOutputVolume and the voice drop parameter answer floats.
HOS_AUDIO_NO_EFFECTS=1 leaves the effects out, to compare. tests/test_audio_effects.py compiles the actual code around
authored samples.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 0c1a6d0ab4a8021593ea992bb2a6ab57d32775d0)
Co-authored-by: Cursor <[email protected]>
Assisted-by: Cursor (Claude Opus 5.5)
fix(audio): the mix biquad filter runs a function of its own, and the new effects switch has its row
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 21s
beanstalk/approval waiting for a BigBean's 👍 on the request
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
87b133593a
From Hookshot's f31d77b2 (f31d77b2c4):
the mix biquad filter no longer borrows the voices' biquad_frame; mix_biquad_block starts a blown-up state over silent.
HOS_AUDIO_NO_EFFECTS, read by the effects' order, gets its row in gpu/vk/switches.def.

Co-authored-by: Cursor <[email protected]>
Co-Authored-By: Mooseca <[email protected]>
Assisted-by: Cursor (Claude Opus 5.5)
Author
Contributor

@Beanstalk Untested in the game so far. Please play about ten minutes inside the Deku Tree and Dodongo's Cavern on Windows and Linux, once with this PR and once with HOS_AUDIO_NO_EFFECTS=1, and report whether the rooms now echo, and any crackle, clipping, sudden loudness or audio underrun lines in longshot_log.txt.

@Beanstalk Untested in the game so far. Please play about ten minutes inside the Deku Tree and Dodongo's Cavern on Windows and Linux, once with this PR and once with HOS_AUDIO_NO_EFFECTS=1, and report whether the rooms now echo, and any crackle, clipping, sudden loudness or audio underrun lines in longshot_log.txt.
Member

@TrashPanda only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for 87b1335, and the PR has changed since (4774d50), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@TrashPanda only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `87b1335`, and the PR has changed since (`4774d50`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
TrashPanda force-pushed feat/audio-effects from 87b133593a
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 21s
beanstalk/approval waiting for a BigBean's 👍 on the request
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 4774d50347
Some checks are pending
beanstalk/approval changed since the request: ask again
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 12s
2026-11-20 02:18:49 +00:00
Compare
Some checks are pending
beanstalk/approval changed since the request: ask again
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 12s
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/audio-effects:TrashPanda-feat/audio-effects'
git switch 'TrashPanda-feat/audio-effects'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
MagicBeanDev/Longshot!1644
No description provided.