2014-04-02 1:48 GMT+06:00 Niels Ole Salscheider <niels_ole at salscheider-online.de>: > Would you like to write such a patch or should I do it? Or do you have an idea > for a better heuristic? I do have an idea for a possibly-better heuristic (see below). However, I have caught a cold, and there is also an extraordinary number of DNS queries we (SafeDNS) get from Turkish users right now, leading to server load issues. So, my health and my work are priorities now :( So, please submit a patch. A possibly-better but untested heuristic is as follows, and I do intend to implement it later, after the Turkish YouTube/DNS situation settles. 1. Collect spectrum and inter-channel correlation data from some music DVDs, take an average. 2. Synthesize a short signal that has roughly the same characteristics. 3. Filter it through the A-weighing filter (see the transfer function in Wikipedia, it is a rational function => the filter is implementable as IIR). 4. Store the result as a short sequence of samples in PA source code. 5. When loading a filter from a wav file, apply it to the test signal from step (4). 6. Take the sum of squares of samples sent to the left headphone. This (due to A-weighing) would represent the subjective loudness of the filtered music. 7. Compare that to the sum of squares of samples sent through the conventional downmixer. Compensate accordingly by scaling the loaded filter. The result should be that the audio filtered through your module and through the conventional downmixer (in src/pulsecore/resampler.c), in average for the music material, would be of the same subjective loudness. I am not sure if that would be sufficient to eliminate the clipping, but we can always multiply the result by the fudge factor later if needed. -- Alexander E. Patrakov