fix: correct 32000 Hz filter coefficients to match original gain_analysis.c#45
Merged
fix: correct 32000 Hz filter coefficients to match original gain_analysis.c#45
Conversation
added 2 commits
January 16, 2026 15:08
…ysis.c The previous 32000 Hz coefficients were incorrect and their source was unclear. This commit updates them to match the original ReplayGain reference implementation from gain_analysis.c. Changes: - Updated YULE_B_32000 coefficients (B[0] was 0.00549... but should be 0.15457...) - Updated BUTTER_A_32000 coefficients - Updated BUTTER_B_32000 coefficients - Added source comments for clarity The coefficients are extracted from ABYule[5] and ABButter[5] in gain_analysis.c where index 5 corresponds to 32000 Hz sample rate. Fixes #42
The test_stereo.mp3 fixture contained APE tags (MP3GAIN_UNDO and MP3GAIN_MINMAX) which caused test_undo_without_previous_gain to fail. This test expects the file to have no APE tag. Removed the APE tag to restore the fixture to a clean state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes incorrect 32000 Hz filter coefficients that did not match the original gain_analysis.c reference implementation.
Problem
As reported in #42, the 32000 Hz filter coefficients in mp3rgain did not match those in the original ReplayGain reference implementation. The first B coefficient was
0.00549836071843but should have been0.15457299681924.Changes
YULE_B_32000coefficients to match ABYule[5] from gain_analysis.cBUTTER_A_32000coefficients to match ABButter[5] from gain_analysis.cBUTTER_B_32000coefficients to match ABButter[5] from gain_analysis.cVerification
The coefficients were extracted from the original gain_analysis.c:
Fixes #42