[PR #672] [MERGED] Avoid hard clipping when explosion sounds overlap #2718

Closed
opened 2026-11-02 15:58:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/672
Author: @Online5277
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: fix/audio-output-limiter


📝 Commits (1)

  • b771c0b Limit overlapping audio without hard-clipping the mixed waveform

📊 Changes

1 file changed (+52 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/audio.rs (+52 -2)

📄 Description

When many explosion voices overlap, the output mixer flattens samples at full scale. Apply shared peak gain to each mixed buffer, with gain recovering over a 50 ms time constant, so overloaded audio retains its waveform and stereo balance.

Refs #488.

Validation: seven audio tests pass, including overlapping voices through the real mixer, quiet playback and recovery across callbacks. Client all-target Clippy with warnings denied, workspace formatting, whitespace and public-tree checks pass.

Needs testing: compare single explosions and mass TNT against vanilla 26.3 at matched volume settings. This addresses the confirmed hard-clipping path; perceived loudness and the buffer-based limiter's dynamics still need listening tests. It does not reproduce OpenAL Soft's compressor exactly.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/672 **Author:** [@Online5277](https://github.com/Online5277) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/audio-output-limiter` --- ### 📝 Commits (1) - [`b771c0b`](https://github.com/horizon-rust/horizon/commit/b771c0b48eb0b08108e5370dc1f041581fe69ceb) Limit overlapping audio without hard-clipping the mixed waveform ### 📊 Changes **1 file changed** (+52 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/audio.rs` (+52 -2) </details> ### 📄 Description When many explosion voices overlap, the output mixer flattens samples at full scale. Apply shared peak gain to each mixed buffer, with gain recovering over a 50 ms time constant, so overloaded audio retains its waveform and stereo balance. Refs #488. Validation: seven audio tests pass, including overlapping voices through the real mixer, quiet playback and recovery across callbacks. Client all-target Clippy with warnings denied, workspace formatting, whitespace and public-tree checks pass. Needs testing: compare single explosions and mass TNT against vanilla 26.3 at matched volume settings. This addresses the confirmed hard-clipping path; perceived loudness and the buffer-based limiter's dynamics still need listening tests. It does not reproduce OpenAL Soft's compressor exactly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:58:31 +07:00
Sign in to join this conversation.
No milestone
No project
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
horizon-rust/horizon#2718
No description provided.