Added album normalization as recommended in AES77#168
Merged
complexlogic merged 2 commits intocomplexlogic:masterfrom Oct 29, 2025
Merged
Added album normalization as recommended in AES77#168complexlogic merged 2 commits intocomplexlogic:masterfrom
complexlogic merged 2 commits intocomplexlogic:masterfrom
Conversation
Owner
|
Code looks fine at a quick glance. I'll have time to do a more in-depth review and testing later. Please add "Fixes #132" to the end of your post so that issue is auto-closed if this PR is merged. |
complexlogic
requested changes
Oct 28, 2025
src/scan.cpp
Outdated
| track.result.album_peak = album_peak; | ||
| track.result.album_loudness = album_loudness; | ||
| if (config.album_as_aes77) { | ||
| double album_loudness = -HUGE_VAL, album_peak = 0.0, album_gain; |
Owner
There was a problem hiding this comment.
Don't use multiple statements in a line. Please separate them.
src/scan.cpp
Outdated
| for (const Track &track : tracks) { | ||
| if (album_loudness < track.result.track_loudness) { | ||
| album_loudness = track.result.track_loudness; | ||
| album_gain = track.result.track_gain; |
Owner
There was a problem hiding this comment.
Assign album loudness only. Album gain will be calculated later at the end of the loop.
src/scan.cpp
Outdated
Comment on lines
708
to
713
| double album_gain = (type == FileType::OPUS && config.opus_mode == 's' ? -23.0 : config.target_loudness) | ||
| - album_loudness; | ||
| for (Track &track : tracks) { | ||
| track.result.album_gain = album_gain; | ||
| track.result.album_peak = album_peak; | ||
| track.result.album_loudness = album_loudness; |
Owner
There was a problem hiding this comment.
Move this code to after the if/else block so that it is common to both -a and -e cases.
src/scan.cpp
Outdated
Comment on lines
685
to
689
| for (Track &track : tracks) { | ||
| track.result.album_gain = album_gain; | ||
| track.result.album_peak = album_peak; | ||
| track.result.album_loudness = album_loudness; | ||
| } |
Owner
There was a problem hiding this comment.
Delete (see above comment about making this code common).
complexlogic
approved these changes
Oct 29, 2025
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.
I needed the option to calculate the album loudness according to the AES77 specification, which recommends to just use the loudest track of an album as the reference for all tracks, and thought it may be helpful for others as well.
Fixes #132