[pulseaudio-discuss] Microphone DC-Offset compensation and noise filtering.

Maarten Bosmans mkbosmans at gmail.com
Mon Jan 10 02:44:36 PST 2011

2011/1/10 IL'dar AKHmetgaleev <akhilman at gmail.com>:
> I have a cheap USB headset which records audio with the little
> DC-Offset and noise at 50Hz.
> As I know it's very usual problem of cheap audio devices and
> integrated audio cards.
> So I'm requesting a module which will filter input stream.
> This pseudo code was suggested in alsa ML:
>> xs=0
>> while (input){
>> xs=.01 xinput +.99 xs
>> xoutput=xinput-xs
>> }
>> (This averages over roughly the last 100 inputs and subtracts the
>> offset). If you want a longer averaging, change the coefficients.

It is wrong to say that the averaging is done over the last 100
inputs. What you are proposing is averaging with exponential
weighting. This means the averaging window is infinately long.

The concept can be useful, but you need a much smaller factor if by
inputs you mean samples. 0.00001 for example would be better, because
then the last period of a 20Hz wave in a 48000Hz signal only
contributes 2.4% to the average (1-.99999^2400), which seems much more

> Will be nice to have such module with sampling period as attribute.

Is there any reason this kind of signal processing wouldn't be more
appropriate in an alsa driver?


More information about the pulseaudio-discuss mailing list