Digital I2S Microphone DC Offset Removal

Hi all,

We have a few digital I2S microphones connected to the I2S ports on the TX1. We can capture the audio correctly from the microphones, however there is a DC offset. This is apparently common on digital microphones, but it causes popping/clicking noises when muting or adjusting the volume. We are trying to determine the best way to remove the DC offset. Ideally it would be at the ALSA level or lower, so the user does not even notice it.

We have tried various things, but none of them are ideal:

  1. Use PulseAudio’s module-ladspa-sink with a dc removal plugin. This works as a proof of concept, but it’s pretty ugly. (problems: we really need a source, not a sink, so this requires multiple virtual/loopback modules linked together to create the correct path, and it gets messy with lots of microphones)
  2. Creating a C program using the PulseAudio libraries to read bytes from stream, modify the buffer and output to module-pipe-source (problems: original mic still exists, adds delay to audio, requires various modules to be connected together, requires the program to be running at all times, possible buffer underrun issues?)
  3. Creating a custom Pulse module (Requires proper environment for building Pulse and modules from source. I have not been able to properly build a pulse module that is recognized by pulse after trying for a few days. This would still leave the original mic there too.)

Possible solutions:

Since our LADSPA dc offset removal plugin works, is there a way to add this LADSPA filter/plugin to an ALSA input? A few places indicate this is possible with asound config, but I haven’t been able to find documentation to explicitly do this.

Perhaps it is even possible to edit the bytes at a lower level, such as in the I2S kernel drivers?

I’ve seen some codecs which list DC removal options in amixer, but the TX1 does not seem to have this. Is it possible to add this?

Any thoughts would be appreciated. Thanks in advance.


I am not aware of any feature in the I2S module to handle this but I am checking to see if there is good solution for this. I will let you know what I find out.



With gsteamer it should be possible to capture from an ALSA device, for example …

$ gst-launch-1.0 -v alsasrc device="hw:tegrasndt210ref,0" ! filesink location=cap.raw

By default, the device ‘hw:tegrasndt210ref,0’ should map to I2S1. Is it possible to place the LADSPA dc offset removal plugin in the sequence of plugins that gstreamer routes the audio through?