devgianlu / go-librespot

Yet another open source Spotify client, written in Go.
GNU General Public License v3.0
75 stars 15 forks source link

Volume normalization #15

Closed blamphos closed 10 months ago

blamphos commented 10 months ago

Question to developers, is there volume normalization implemented in go-librespot or is it supported at all? I've noticed that go-librespot produces a bit lower SPL (several dB's) compared to librespot (Rust) implementation which does have a parameter to set the normalization. I've been using external volume control in both cases where ALSA does not use any softvol plugin either.

devgianlu commented 10 months ago

The normalisation is implemented here: https://github.com/devgianlu/go-librespot/blob/4d530d350ed969a74fe9be5e0849bda7ab2e6d7b/audio/metadata.go#L184-L192

I have just pushed a change to allow specifying a normalisation_pregain configuration option: https://github.com/devgianlu/go-librespot/commit/ba47d173f86b77a0d83241daf87757ee47f30f6f

blamphos commented 10 months ago

Did some testing with pulling the latest commits. For some reason I can't change normalisation_pregain from config file. Normalisation factor changes only if the default value of pregain (1.0) is being modified in main.go.

devgianlu commented 10 months ago

Oh yeah my bad, should be fixed now.

blamphos commented 10 months ago

Thank you! Works just as expected now.