[pulseaudio-discuss] [PATCH 0/7] LFE filter patches

David Henningsson david.henningsson at canonical.com
Fri Feb 27 00:54:04 PST 2015



On 2015-02-17 23:22, Alexander E. Patrakov wrote:
> 17.02.2015 17:29, David Henningsson wrote:
>> Changes since v1:
>>   - Fix according to Alexander's comments
>>   - A new patch has been added that removes dead code imported from
>> Chrome OS.
>> For easier reviewing, I will also send a total of the first three
>> patches.
>>
>> Also note that the current routing logic are not optimal, e g,
>> when on 2.1 speakers, plug headphones in, then unplug headphones
>> again, the
>> result might be that the stereo profile is selected instead of the
>> expected 2.1
>> profile. This is not an error with this patch set but might limit its
>> usefulness.
>>
>> David Henningsson (5):
>>    lfe-filter: Import code from the Chrome OS audio server
>>    lfe-filter: Enable LFE filter in the resampler
>>    lfe-filter: Cleanup and refactor
>>    lfe-filter: Add rewind support
>>    resampler: Make some basic functions for rewinding
>>
>> Hui Wang (2):
>>    daemon-conf: enable the lfe remixing by default
>>    lfe-filter: change the crossover frequency as a parameter
>
> Well, I have tested this quantitatively using a null sink.
>
> pacmd load-module module-null-sink rate=44100
> channel_map=front-left,front-right,lfe
>
> parec --fix-format --fix-rate --fix-channels --file-format=wav
> --format=s16le --rate=44100 --channels 3 -d null.monitor response.wav &
> paplay -d null sweep.wav ; killall parec ; wait  # where sweep.wav is a
> mono file containing a sine wave sweep
>
> audacity response.wav  # look at the waveform
>
> Result: the crossover frequency should be at 120 Hz by default, the
> filter should attenuate the signal by 6 dB at this frequency, and it
> indeed behaves this way. If I mix the right channel and the LFE channel
> together, the result corresponds to a flat frequency response.
>
> However, I have some doubts about the correct normalization. Let's
> consider this use case.
>
> Someone prefers to use his full 5.1 system when watching DVDs and
> BluRays, but does not like that PulseAudio uses rear and center speakers
> for stereo content like CDs. Still, he needs a subwoofer and a software
> crossover, because the satellite speakers just don't reproduce bass well
> enough. So he switches manually between 5.1 and 2.1 profiles as needed
> depending on the content.
>
> Now consider a passage on a music CD that contains e.g. some drums in
> the left channel and nothing on the right. PulseAudio averages the left
> and right channels, then filters the result, and gives that to the
> subwoofer. I.e., 50% of the bass from drums get there in this example,
> and 100% of high-frequency content get to the left speaker. Without the
> crossover, in the stereo profile, 100% of both bass and non-bass from
> drums get to the left speaker - and that is definitely balanced in terms
> of frequency content if the speaker reproduces all frequencies
> accurately. So, for the example with the LR4 crossover to sound
> balanced, the subwoofer must be 6 dB more sensitive than the left
> speaker. The important thing to take back is the 100%/50% ratio of
> non-bass in the left speaker and bass coming to subwoofer, and the
> presumably-balanced result.
>
> Now consider the same passage on a DVD in the 5.0 arrangement (i.e.
> there is no LFE channel in the soundtrack). The drums are in the front
> left channel, and there is nothing in the other channels. PulseAudio
> upmixes this to 5.1, and the LFE is synthesized as an average of all
> channels. Thus, it gets 20% of the bass from the drums, while the
> front-left speaker still gets 100% of non-bass. As these amplitudes are
> not in the same proportion as in the CD case, the system that sounded
> balanced previously would not do so now.
>
> So this looks like an "average vs sum of channels" question regarding
> the LFE filter input. Of course, without the filter, we just have to use
> the average to avoid clipping on typical music material.

But the clipping should be avoided in the LFE filter case too. E g, a 70 
Hz sine wave played back in all source channels would make the LFE clip 
(in the case of using sum rather than average).

If you play back stereo material through a 5.1 system, the left channel 
gets duplicated to both front left, rear left, and 50% in center and LFE 
channels. Thus, the 100%/50% ratio applies to "front left + rear left + 
half of center". The 100%/20% ratio applies to front left only.

If you decide to change your speaker setup so that you have a 2.1 system 
only, (and thus change your "front left" speaker to become a "left" 
speaker) then naturally you should adjust the balance between speakers too.

I think it is impossible to come up with an balance algorithm that 
completely satisfies both the "I want my stereo as 2.1" and "I want my 
stereo as 5.1" crowds, but for making these transitions easier: if we 
don't already do so, I think we should save volume per port+profile 
combo, so that the user can setup balance once per port+profile and 
don't have to adjust volume when changing profiles.

> Alternatively, the answer may be just "don't switch profiles like that".
> I don't know how hardware 5.1 AV receivers react to this use case,
> because I don't have one yet (and maybe, depending on the listening
> tests, will spend money on a really good stereo system instead).
>
> I think that the definite answer to this balance paradox will come from
> measurements of the individual frequency response of each laptop speaker
> for a laptop with a built-in subwoofer. It would also be interesting to
> see what Windows does here.
>

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list