f2e-spec
f2e-spec copied to clipboard
Read any Replay Gain meta-information, use it to normalise the audio "loudness".
NOTE: I closed my other pull request since it was simply quicker to re-merge the changes manually (with meld) rather than muck around in the leavings of git. I had managed to accidentality pull in a huge whack of white-space changes that needed to disappear. Please accept my apologies.
What does this PR do?
This change implements loading and use of any Replay Gain meta information found in the audio files. Files might not have any Replay Gain information in them. To add it, you can use tools like loudgain or mp3gain. One can easily run loudgain over all of Performous' audio tracks using the UNIX "find" command, with the --exec option.
Using the patch generally results in soft audio being made louder and vice-versa. But don't expect that all music becomes "perfectly" normalised. A particularly loud piece of music might still be perceived as quite loud - but not enough to warrant manual volume-knob intervention.
It's been tested for many weeks on hundreds of pure-audio and audio-with-video files.
Closes Issue(s)
Does not close any issues.
Motivation
When one has audio from different sources, more often than not, the base-level volume of the audio is different. These differences are prevalent even in professionally mastered audio recordings simply due to their jurisdiction. The long-term idea is to somewhat normalise the "loudness" of the audio track, such that continual manual volume adjustments don't need to be made while enjoying Performous.
How to Test
- Set your output volume to whatever your normal playback volume is
- Identify some music items in your Performous song list that are either too soft, or too loud
- Play the item in Performous, noting how loud/soft it is
- Use
loudgainto create the meta-information in the audio file (see below) - Play the item again in Performous
- Note the debug log when the gain is found: ffmpeg/debug: readReplayGain() - GAIN IS [-3.73] dB, Linear Gain is [0.65]
- Listen again to the volume of the track, soft tracks should be made louder, loud tracks softer.
- I found that generally the patch lowers the volume of most tracks sourced from video-viewing websites, since these places normalise the sound to a louder base-level.
- For very formal testing, I guess you could manually adjust the audio volume in Audactiy, and verify it's corrected.
There is a new configuration item in [Audio] that turns the feature on/off.
More
The libav function that fetches the gain data av_stream_get_side_data() is marked as deprecated. Probably it will need to be migrated to the C++(?) non-deprecated version when all the rest of the API is done.
Additional Notes
To quickly add Replay Gain meta information, an efficient way is to install "loudgain" (see above), then execute it for every .mp3 in the music archive. I've never had an issue with it, but maybe make a backup first. Best kick this off, watch for a few seconds, then go have a long tea break.
$ find . -iname \*mp3 -exec loudgain -q -I3 -S -L -a -k -s e {} \;
$ find . -iname \*m4a -exec loudgain -q -a -k -s e {} \;
(Note: last time I looked there was a bug with loudgain and m4a files, but also a patch mentioned in the github comments)
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
Download the artifacts for this pull request:
- Performous-1.3.1-1000-8cbde65-alpha-debian_11.deb.zip
- Performous-1.3.1-1000-8cbde65-alpha-ubuntu_22.04.deb.zip
- Performous-1.3.1-1000-8cbde65-alpha-fedora_39.rpm.zip
- Performous-1.3.1-1000-8cbde65-alpha-fedora_35.rpm.zip
- Performous-1.3.1-1000-8cbde65-alpha-fedora_40.rpm.zip
- Performous-1.3.1-1000-8cbde65-alpha-fedora_38.rpm.zip
- Performous-1.3.1-1000-8cbde65-alpha-fedora_36.rpm.zip
- Performous-1.3.1-1000-8cbde65-alpha-debian_12.deb.zip
- Performous-1.3.1-1000-8cbde65-alpha-fedora_37.rpm.zip
- Performous-1.3.1-1000-8cbde65-alpha-ubuntu_24.04.deb.zip
- Performous-1.3.1-1000-8cbde65-alpha-ubuntu_20.04.deb.zip
- Performous-1.3.1-1000-8cbde65-alpha.AppImage.zip
- Performous-1.3.1-1000-8cbde65-alpha-msvc.exe.zip
- Performous-1.3.1-1000-8cbde65-alpha.dmg.zip
- Performous-1.3.1-1000-8cbde65-alpha-mingw-w64.exe.zip
This service is provided by nightly.link. These artifacts will expire in 90 days and will not be available for download after that time.
Just coming back from a hiates, but in its current state it'll either normalize the audio file or not (if loudness info is missing) for a given stream if i'm correct. Would be good to set this feature behind a config flag so users can enable it if they know every file has the loudness info in it. Else it'll trigger the same behavior still: some songs are louder than others
As i'm using different sources (with auto-updates) i'm not going to run loudgain on my whole library. I'd rather mix it with my mixer and compressor then to have the software responsible for that.
For most users however this will be a great feature so i think the config item can be enabled by default (as it'll improve most users) but the more advanced users (with external hardware) will have an option to disable this feature entirely
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Blocked by #1005 for ffmpeg build errors osx (and probably windows too)
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code