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 #101

Closed
sashahilton00 opened this issue Jan 29, 2018 · 10 comments
Closed

Idea/Proposal: Loudness normalization #101

sashahilton00 opened this issue Jan 29, 2018 · 10 comments

Comments

@sashahilton00
Copy link
Member

Issue by herrernst
Saturday Jan 06, 2018 at 12:26 GMT
Originally opened as plietar/librespot#270


(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.

@sashahilton00
Copy link
Member Author

Comment by cortegedusage
Sunday Jan 07, 2018 at 21:05 GMT


hmm this sounds interesting,

although I'm not a programmer but merely an enthusiast. I'm wondering how
you apply those value's because as far as I know (and can tell by listening)
Spotify is not using any kind of gain reduction (replaygain) to get the
volume straight but it uses compression to achieve this.
So maybe this is why you don't get the results you want.

Btw. Is there any light on a new owner for librespot, because good things
are happening now, shuffle, repeat, start volume.
But not in one place, and it would be a shame because it's such a good
piece of software.

anyways, we'll see.

2018-01-06 13:26 GMT+01:00 herrernst [email protected]:

(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 if librespot is started with
--enable-volume-normalization (I don't yet know what the others are good
for): https://github.com/herrernst/librespot/tree/volume-normalization
The resulting level still different from the Spotify client though.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
plietar/librespot#270, or mute the thread
https://github.com/notifications/unsubscribe-auth/AV69TdCwrpHriTaHya3RIG-WC9Crqgvzks5tH2ZbgaJpZM4RVS5x
.

@sashahilton00
Copy link
Member Author

Comment by herrernst
Sunday Jan 07, 2018 at 21:11 GMT


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

@sashahilton00
Copy link
Member Author

Comment by cortegedusage
Sunday Jan 07, 2018 at 21:36 GMT


Not on any spotify documentation, but here is what I came up with

http://productionadvice.co.uk/spotify-same-volume-setting/

hmmm and ofcourse I also find a post claiming the opposite...

https://community.spotify.com/t5/Social-Off-Topic/How-does-the-loudness-normalization-algorithm-work/td-p/1603671

but reading this:

https://community.spotify.com/t5/Live-Ideas/Desktop-Other-Improve-Spotify-s-volume-normalisation/idi-p/1128406

I come to think they might do both.
So use replaygain to normalize the levels and compression to get a more
radio like feel when listening so there is no audible difference when
listening to the music.

anyway. these are my five cents.

2018-01-07 22:11 GMT+01:00 herrernst [email protected]:

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


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
plietar/librespot#270 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AV69TV81CY98Xe6NHjZRtbE061dbtbO_ks5tITMdgaJpZM4RVS5x
.

@sashahilton00
Copy link
Member Author

Comment by cortegedusage
Monday Jan 08, 2018 at 08:34 GMT


remaining question is, how does your implementation sound like.
because if it is actually replay gain factor you apply and there is no
further compression,
it might not be strange it sounds different from the native spotify client.

And this might be something I can imagine users would like to have (I would)

So is it actually doing what it should do? normalizing the volume?

and as I don't have a development setup would you mind sharing a binairy as
I am very curious how it sounds?

thanks
Dennis

2018-01-07 22:36 GMT+01:00 Dennis van Paassen [email protected]:

Not on any spotify documentation, but here is what I came up with

http://productionadvice.co.uk/spotify-same-volume-setting/

hmmm and ofcourse I also find a post claiming the opposite...

https://community.spotify.com/t5/Social-Off-Topic/How-does-
the-loudness-normalization-algorithm-work/td-p/1603671

but reading this:

https://community.spotify.com/t5/Live-Ideas/Desktop-Other-
Improve-Spotify-s-volume-normalisation/idi-p/1128406

I come to think they might do both.
So use replaygain to normalize the levels and compression to get a more
radio like feel when listening so there is no audible difference when
listening to the music.

anyway. these are my five cents.

2018-01-07 22:11 GMT+01:00 herrernst [email protected]:

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


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
plietar/librespot#270 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AV69TV81CY98Xe6NHjZRtbE061dbtbO_ks5tITMdgaJpZM4RVS5x
.

@sashahilton00
Copy link
Member Author

Comment by herrernst
Monday Jan 08, 2018 at 21:56 GMT


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

@sashahilton00
Copy link
Member Author

Comment by kingosticks
Tuesday Jan 09, 2018 at 16:02 GMT


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

@sashahilton00
Copy link
Member Author

@sashahilton00
Copy link
Member Author

Comment by cortegedusage
Wednesday Jan 24, 2018 at 09:25 GMT


@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?

@sashahilton00
Copy link
Member Author

Comment by herrernst
Wednesday Jan 24, 2018 at 19:44 GMT


@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 ...

@ComlOnline
Copy link
Contributor

Please see #15 for continued discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants