librespot icon indicating copy to clipboard operation
librespot copied to clipboard

Normalizer stereo imaging and performance improvements

Open roderickvd opened this issue 8 months ago • 2 comments

Previously, the normalizer integrator and peak were recalculated as if the samples were a mono stream. If actually one channel required limiting and the other not, this could cause nervousness in the stereo imaging.

This PR changes the normalizer to:

  • calculate the integrator and peak for each channel individually
  • then couple the left/right channel by using the limit gain of each interleaved pair of samples
  • be faster by optimizing the hot code path and reducing the number of branches

Again, please test this for me as I don't have a Spotify account anymore. I ported it from pleezer with my permission. My "go to" track to test limiting is "Blumine" by Mahler on "Masterpieces in Miniature".

roderickvd avatar Apr 05 '25 13:04 roderickvd

So I used the state of the branch for a bit (with normalization enabled) and it seems to not have (at least for me) noticeable interference or audio spikes. I will test it for a day more and then we could probably get it merged :D

photovoltex avatar Apr 08 '25 17:04 photovoltex

No prob I'll make some minor changes anyway.

roderickvd avatar Apr 28 '25 21:04 roderickvd