[pulseaudio-discuss] [PATCH 2/6] lfe-filter: Enable LFE filter in the resampler
Alexander E. Patrakov
patrakov at gmail.com
Tue Feb 10 09:58:07 PST 2015
10.02.2015 08:59, Alexander E. Patrakov wrote:
> 10.02.2015 02:27, David Henningsson wrote:
>>> Filters can overshoot. Please clamp to the range of short.
>>
>> Is this really true here - as Butterworth and LR4 filters never boost
>> any frequency, only attenuate, can this filter still overshoot?
>
> Well, I think yes. See here for an example how an ideal brickwall filter
> (that also only removes frequencies) overshoots (by about 9%) when
> applied to a square wave:
>
> https://en.wikipedia.org/wiki/Gibbs_phenomenon
>
> If you want to test the worst case for sure, please save the impulse
> response of the whole filter (obviously, you will have to cut it off at
> some point in time), and replace all positive samples with +32760, and
> all negative ones with -32760. Then time reverse the result, add some
> zeros at the end just in case, and run the result through the filter. I
> can do it for you after my official work (i.e. later today).
Just did this. Indeed, both lowpass and highpass filters overshoot - and
they should. The worst-case testcases are attached, and both testcases
are designed so that the absolute values of input samples don't exceed
10000 (i.e. -10.3 dB) for illustrative purposes. So, any sample in the
response with the absolute value more than 10000 indicates overshooting.
Here is how to run the testcases:
pacmd load-module module-null-sink format=float32ne rate=44100
channel_map=front-left,front-right,lfe
parec --fix-format --fix-rate --fix-channels --file-format=wav
--format=float32le --rate=44100 --channels 3 -d null.monitor
response-to-lf.wav & paplay -d null testcase-lf.wav ; killall parec
parec --fix-format --fix-rate --fix-channels --file-format=wav
--format=float32le --rate=44100 --channels 3 -d null.monitor
response-to-hf.wav & paplay -d null testcase-hf.wav ; killall parec
Then open response-to-lf.wav and response-to-hf.wav in Audacity and look
at waveforms. Try to amplify them, Audacity will show you the current
peak level. In both original testcases, it is -10.3 dB.
In the response to the high-frequency test, the highpass filter produces
output that can be amplified only by 1.1 dB without clipping. The peak
value is 28740 - i.e. we have more than 187% of overshoot! For the
low-frequency test, the lowpass filter produces output that can be
amplified only by 9.2 dB without clipping. The peak value is 11321 -
i.e. we still have an overshoot by 13%. These overshoot values are for
the worst cases.
--
Alexander E. Patrakov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase-hf.wav
Type: audio/x-wav
Size: 1676 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150210/eecdd2db/attachment-0002.wav>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase-lf.wav
Type: audio/x-wav
Size: 4048 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150210/eecdd2db/attachment-0003.wav>
More information about the pulseaudio-discuss
mailing list