Hello Alexander, On Tuesday 11 March 2014, 15:00:31, Tanu Kaskinen wrote: > On Sun, 2014-03-09 at 00:57 +0600, Alexander E. Patrakov wrote: > > Hello. > > > > [Do not blindly apply patches from this e-mail! They mutually exclusive, > > and I don't have a firm opinion which one of them is correct.] > > > > Today I tried to improve the existing module-virtual-surround-sink (but > > the same issue also affects the IIR-based rewrite that is still sitting > > on my laptop). The problem is: the current normalization code does not > > do what it is designed to do. The module clips on some testcases. Let me > > copy-paste the problematic code for easy discussion. > > <snip> > > > Thoughts? > > My thoughts: > > The scaling should be put in its own function with a comment that > explains why the scaling is done, a high level description of how the > scaling algorithm works, and a note that it's unclear whether the > algorithm actually makes sense. Something like this could be included > too: "This algorithm doesn't pretend to be perfect, it's just something > that appears to work (not too quiet, no audible clipping) on the > material that it has been tested on. If you find a real-world example > where this algorithm results in audible clipping, please write a patch > that adjusts the scaling factor constants or improves the algorithm (or > if you can't write a patch, at least report the problem to the > PulseAudio mailing list or bug tracker)." Would you like to write such a patch or should I do it? Or do you have an idea for a better heuristic? Regards, Ole