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

Idea/Proposal: Loudness normalization #270

Open
herrernst opened this issue Jan 6, 2018 · 11 comments
Open

Idea/Proposal: Loudness normalization #270

herrernst opened this issue Jan 6, 2018 · 11 comments

Comments

@herrernst
Copy link
Contributor

herrernst commented Jan 6, 2018

(I know this project is not really maintained anymore, but I wanted to document this in case if anyone is interested.)

The official Spotify clients have an option (enabled by default) to normalize volume, which adjust the volume of differently mastered songs to sound equally loud (see https://en.wikipedia.org/wiki/Audio_normalization). This is primarily important when playing playlists.

Some pre-computed compensation values are stored in the proprietary ogg header (as 32 LE floats, starting at offset 144). I have a branch which reads these values and applies the first (I don't yet know what the others are good for) if librespot is started with --enable-volume-normalization: https://github.com/herrernst/librespot/tree/volume-normalization The resulting level still different from the Spotify client though.

@cortegedusage
Copy link

cortegedusage commented Jan 7, 2018 via email

@herrernst
Copy link
Contributor Author

Are you really sure that Spotify applies compression? Do you have any references on that?

@cortegedusage
Copy link

cortegedusage commented Jan 7, 2018 via email

@cortegedusage
Copy link

cortegedusage commented Jan 8, 2018 via email

@herrernst
Copy link
Contributor Author

I just apply the replaygain factor, so it doesn't sound special, everything else (i.e. implementing a compressor/limiter) would be nontrivial

@kingosticks
Copy link

@herrernst, out of interest, how did you discover where to find the values? Any ideas what goodies lay between bytes 160 and 167?

@cortegedusage
Copy link

@herrernst
I've been using this for a week now or so. And it is working quite well, this is a welcome addition.
But occasionaly I've encountered some strange sounds added, which aren't there when running with librespot without the replaygain factor...
one track i've encountered is:

https://open.spotify.com/track/0CQMJlkWMcpiqyplxaYPH9?si=-x6V8wzXQWW3SB3h2Teb5w

is it just me? or are you also hearing this?

@herrernst
Copy link
Contributor Author

@cortegedusage thanks for your report. That is indeed a problem, that song is very quiet, and will be boosted which probably results in clipping. I will take a look at it hopefully sometime ...

@herrernst
Copy link
Contributor Author

@cortegedusage I've added a commit on my branch which prevents clipping by reducing the volume if necessary.

@cortegedusage
Copy link

@herrernst thanks unfortunately i don't have time to test right now. But it looks good

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

3 participants