Skip to content

fix: reduce audio loudness and pulse channel aliasing - #2

Merged
bubio merged 1 commit into
mainfrom
fix/audio-loudness-aliasing
Oct 5, 2026
Merged

bubio merged 1 commit into
mainfrom
fix/audio-loudness-aliasing

Conversation

@bubio

@bubio bubio commented Oct 5, 2026

Copy link
Copy Markdown
Owner

概要

音が大きすぎて割れる問題と、元の音にない別の周波数が聞こえる問題を修正する。

変更

  • 出力段 (Packages/App/Src/Audio.rux): 実機のカップリングコンデンサ相当の DC 除去ハイパスフィルタ(係数は SameBoy 準拠で約 0.992)を追加し、出力ゲインを 50% にした。ミキサーは最大音量でちょうどフルスケールになるため、SDL のリサンプリングで生じるオーバーシュートが飽和して音が割れていた。
  • APU (Packages/Core/Src/Apu.rux): 矩形波 ch1/ch2 も wave/noise と同じく区間平均(ボックスフィルタ)を取るようにした。ad4300a でサンプルレートを 22050Hz に下げたことで、点サンプリングによる高調波の折り返しが非整数倍の音として聞こえていた。
  • セーブステート (Packages/Core/Src/SaveState.rux): 追加した pulse のアキュムレータは保存せず、ロード時に 0 に戻す。形式は変えていない。

確認

  • scripts/test.sh 全 PASS(dmg_sound / SaveState / ApuBatch の PCM 一致を含む)
  • scripts/bench_cpu.sh --release: 1488% → 1483% realtime
  • 実機での聴感確認済み

🤖 Generated with Claude Code

- Add a DC-blocking high-pass filter (SameBoy-equivalent coefficient) and
  50% output gain in the audio output stage. The mixer reaches full scale
  at max volume, so resampling overshoot saturated and distorted.
- Box-filter pulse channels (ch1/ch2) like wave/noise. Point sampling at
  22050 Hz folded harmonics back as inharmonic tones.
- Pulse accumulators are not saved in save states (reset on load), so the
  save state format is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bubio
bubio merged commit daeda77 into main Oct 5, 2026
4 checks passed
@bubio
bubio deleted the fix/audio-loudness-aliasing branch October 5, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant