Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metaflac --scan-replay-gain precision #536

Closed
joshstoik1 opened this issue Jan 12, 2023 · 5 comments
Closed

metaflac --scan-replay-gain precision #536

joshstoik1 opened this issue Jan 12, 2023 · 5 comments

Comments

@joshstoik1
Copy link

Hi there!

It would be helpful if metaflac --scan-replay-gain formatted its values to the same precision as --add-replay-gain, i.e. %1.8f rather than just %f.

The more decimal places the merrier, I always say…

Thanks!

@ktmf01
Copy link
Collaborator

ktmf01 commented Jan 12, 2023

If I run flac -f --replay-gain somefile.flac and then run metaflac --list somefile.flac I get

    comment[0]: REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB
    comment[1]: REPLAYGAIN_TRACK_GAIN=-3.85 dB
    comment[2]: REPLAYGAIN_TRACK_PEAK=0.86211973
    comment[3]: REPLAYGAIN_ALBUM_GAIN=-3.85 dB
    comment[4]: REPLAYGAIN_ALBUM_PEAK=0.86211973

If I then run metaflac --remove-all-tags somefile.flac, then metaflac --add-replay-gain somefile.flac and finally metaflac --list somefile.flac again, I get the exact same values, with the same precision.

So I don't seem to be able to reproduce the issue.

The %1.8f is only used for the peaks, not for the gain. Also, I think having dB gain values with more than one than one decimal place is already pretty pointless, let alone 8.

@ktmf01
Copy link
Collaborator

ktmf01 commented Jan 12, 2023

Okay, I misunderstood the question. I was under the impression you were comparing metaflac and flac, I wasn't aware of the function --scan-replay-gain. If I run metaflac --scan-replay-gain somefile.flac I indeed get a different precision 05 - 32bps audio.flac: -3,849998 0,862120 -3,849998 0,862120.

So, you would like more decimal places for the peak value? Why do you think these extra decimal places make sense? For 16 bit audio, the difference for one quantization step is only 0,000030, so adding more decimal places only makes sense for 24-bit audio.

@joshstoik1
Copy link
Author

Thanks for the quick response, @ktmf01!

My motivation for the request is to make it easier/faster to apply replaygain data to files conditionally, primarily to avoid writing any changes to the master files unless there are actual changes worth writing. (For me, this helps prevent lots of backup-related I/O for silly things like arbitrary changes to tag ordering.)

At the moment, I copy the files from an album, run metaflac --add-replay-gain against those copies, parse the results from their metadata, remove the copies, compare the values with those in the original files, and apply them if different.

If metaflac --scan-replay-gain could give me the same peak values, I could avoid a lot of that runaround. 😉

@ktmf01
Copy link
Collaborator

ktmf01 commented Jan 12, 2023

The problem is that other applications might rely on the precision as it is right now.

Also, I don't know what your primary use is here, but the algorithms metaflac uses are considered outdated by many. See for example #96. You might be better off using some tool other than metaflac to calculate replaygain values altogether.

@joshstoik1
Copy link
Author

Thanks @ktmf01, that makes sense. I'll take a look at some of the newer tools instead.

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

No branches or pull requests

2 participants