[pulseaudio-discuss] New Module: module-lfe-lp

Justin Chudgar justin at justinzane.com
Tue Mar 19 09:01:03 PDT 2013


On Tuesday, March 19, 2013 11:44:49 AM Alexander E. Patrakov wrote:
> 2013/3/19 Justin Chudgar <justin at justinzane.com>:
> > I've created a module to ensure that only low frequencies are sent to
> > devices at the end of an "lfe"/"subwoofer" channel. This module allows
> > the user to select the master channel, the low pass cutoff frequency (aka
> > corner freq, -3dB freq) and the number of filter poles.
> 
> I have received this e-mail and will review the DSP-related part of
> the file later today (when I return from work). However, even based on
> this short description and a cursory examination of the file, I can
> say that some of my criticisms are not addressed.
> 
> First, it is said nowhere in the comments that you implement a
> Butterworth IIR filter.
I've updated the comments. If they are still inadequate, let me know what 
lines you need documented better.
> 
> Second, you copy the non-LFE channels straight from input to output,
> and this is a Bad Thing if any filtering is applied to LFE. Please
> calculate the delay introduced by the filter and apply it to other
> channels if you still want to copy them (but see below).
> Unfortunately, I don't know the formula that allows one to calculate
> the phase delay introduced by the Butterworth filter (don't confuse
> this with group delay). Still, given some paper, pen, and some time,
> it should be possible to derive from the transfer function using the
> low-frequency limit. However, due to the objection below, it is
> pointless.
I am attempting to write some Python code to analyze the output of this module 
however, IANASE (I Am Not A Signals Engineer) and I am literally learning all 
of this from Google searches, Wikipedia, and lots of experimentation with 
octave and ipython. 

While I genenerally understand that filtering induces frequency dependent phase 
changes -- phase delay --  in the filtered signal, I do not understand why this 
is critical for an lfe channel. At the ~10Hz->200Hz range that I expect, my 
understanding is that it is very difficult for humans to detect audio phase 
leading to the inability to localize low frequency sound sources. 

Additionally, the use case I had in mind for this module involves a physical 
subwoofer that is spacially separated from the normal left/right/rear-
left/rear-right/center speakers. Combined with the above, my understanding is 
that the phase distortion in the lfe channel introduced by my module should be 
almost unnoticeable.

If you can help someone of my limited knowledge understand what is most 
critical to the listening experience, I would be most grateful.
> 
> I still maintain that filtering LFE (and only LFE) is the wrong thing
> to do at all. It doesn't help with 5.0 concert recordings (as found on
> music BluRays) and 2.0 recordings (found on audio CDs) where low
> frequencies are in the non-LFE channels (and should be moved to the
> LFE channel). Yes, this is a different problem from the one you are
> trying to fix (you assume that there is some non-LFE content in the
> LFE channel and try to filter it out). A correct implementation of a
> digital crossover filter is what will help both of our cases.
The 2.0 stereo recordings are my personal primary use case. My subwoofer can 
reproduce 20-200Hz, my front-left/right speakers can reproduce 28-20000Hz, my 
center can reproduce 135-25000Hz, my rear-left/right can reproduce 80-20000Hz. 
With this setup, the most limited element is the sub, the next most limited is 
the center.

Since both the sub and center are synthesized by simple remixing of the left 
and right, I do like you idea of a crossover between those channels. I will 
start to work on that.
> 
> Given that you now have Butterworth filters (congratulations! but I
> still have to check it for correctness), implementing a LR4 crossover
> filter should be easy. According to
> http://en.wikipedia.org/wiki/Linkwitz–Riley_filter , you have to:
> 
> 1. Implement a 2nd order (this is not a user-adjustable parameter due
> to phase considerations, it really must be 2nd order) Butterworth
> lowpass filter and a 2nd order Butterworth highpass filter for the
> same user-selected cut-off frequency.
> 
> 2. Instantiate 4N copies of the filter, where N is the number of
> channels of the acoustic system. Connect one lowpass filter and one
> highpass filter to each input channel. After each filter, insert
> another filter of the same kind. Note that applying a 2nd order
> Butterworth filter twice is not the same as applying a 4th order
> Butterworth filter once.
> 
> 3. Now you have 2N filtered signals: twice-highpass-filtered left,
> twice-lowpass-filtered left, twice-highpass-filtered right,
> twice-lowpass-filtered right, ... , twice-highpass-filtered LFE,
> twice-lowpass-filtered LFE.
> 
> 4. For non-LFE outputs, give them the sum of the corresponding
> twice-highpass-filtered input channel and 1/(N-1) of the
> twice-highpass-filtered LFE input channel.
> 
> 5. For the LFE output, give it the sum of all twice-lowpass-filtered
> inputs (both LFE and non-LFE). Note: this can clip, it needs
> additional discussion what is the correct thing to do with it in
> PulseAudio context. Applying 1/(N-1) gain to all final outputs
> (including step (4)) is definitely safe, but users may complain that
> the filter loses a lot of volume. Maybe a configurable parameter is
> what's needed.
> 
> If you want to implement a LR2 crossover instead, do this:
> 
> 1. Implement a 1st order (this is not a user-adjustable parameter due
> to phase considerations, it really must be 1st order) lowpass filter
> and a 1st order highpass filter for the same cut-off frequency.
> 
> 2. Instantiate 4N copies of the filter, where N is the number of
> channels of the acoustic system. Connect one lowpass filter and one
> highpass filter to each input channel. After each filter, insert
> another filter of the same kind.
> 
> 3. Now you have 2N filtered signals: twice-highpass-filtered left,
> twice-lowpass-filtered left, twice-highpass-filtered right,
> twice-lowpass-filtered right, ... , twice-highpass-filtered LFE,
> twice-lowpass-filtered LFE.
> 
> 4. For non-LFE outputs, give them the sum of the corresponding
> inverted twice-highpass-filtered input channel and 1/(N-1) of the
> non-inverted twice-highpass-filtered LFE input channel.
> 
> 5. For the LFE output, give it the sum of all twice-lowpass-filtered
> non-inverted inputs (both LFE and non-LFE).
> 
> In both cases, I have sent the (misplaced) high-frequency portion of
> the LFE channel to all remaining speakers. Feel free to send it only
> to the center (without the 1/(N-1) factor) or maybe discard, as you
> did in your module. Or make this an option.

I'll try to do this. My question is, from a pulseaudio code perspective, 
should this be in a module at all? Since this is a thorough and proper way to 
achieve remixing of sources, this code should live in the daemon itself, 
shouldn't it?

Thanks!

> --
> Alexander E. Patrakov
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


More information about the pulseaudio-discuss mailing list