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

Provide possibility for Album Gain calculations #58

Closed
Holzhaus opened this issue Oct 7, 2024 · 4 comments · Fixed by #59
Closed

Provide possibility for Album Gain calculations #58

Holzhaus opened this issue Oct 7, 2024 · 4 comments · Fixed by #59

Comments

@Holzhaus
Copy link
Contributor

Holzhaus commented Oct 7, 2024

I have multiple track that I would like to analyze individually and then compute the album gain (which is the gain of the concatenation of all tracks). I'd like to avoid analyzing all the audio data twice. If I understand correctly this could be archieved like this:

album_gating_block_count = 0
album_track_energy_sum = 0

for track in album_tracks:
    album_gating_block_count += track.gating_block_count
    album_track_energy_sum += track.energy * track.gating_block_count

album_energy = album_track_energy_sum / album_gating_block_count

This means I need the energy for each track and the number of gating blocks, so that I can compute the overall energy of the album. I can calculate each track energy from its loudness value by inverting https://github.com/sdroege/ebur128/blob/main/src/utils.rs#L25, but I do not know how many gating blocks the track has.

Could you expose methods for this?

@sdroege
Copy link
Owner

sdroege commented Oct 14, 2024

Sounds like a good idea. Do you want to provide a PR for exposing methods that allow you to calculate the album gain? If you can also add an example that makes use of them to calculate album gain that would be even better :)

@Holzhaus
Copy link
Contributor Author

Alright, I opened PR #59.

@Holzhaus
Copy link
Contributor Author

Holzhaus commented Oct 25, 2024

@sdroege Do you want to tag a new release? Or anything else missing?

@sdroege
Copy link
Owner

sdroege commented Oct 26, 2024

Nothing missing, I was going to do that today :) See #60

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 a pull request may close this issue.

2 participants