Asound.conf AGC & Denoise

Thought I would throw it in here as tends to be more tinkerers in here.

I think I may mentioned this before but never given any specific details on how to install.

libasound2-plugins (alsa-plugins) doesn’t install the speex plugins because in Debian speex-dsp is an old rc-1 version or something.

So if you have a asound.conf say as

 pcm.!default {
    type asym
    playback.pcm "plughw:2"
    capture.pcm  "agc"

pcm.array {
 type hw
 card 2

pcm.cap {
 type plug
 slave {
   pcm "array"
   channels 2
 route_policy sum

pcm.agc {
 type speex
 slave.pcm "cap"
 agc 1
 agc_level 8000
 denoise yes
 dereverb no

Don’t be surprised if it doesn’t work.

First do the usual install

sudo apt install libasound2 libasound2-dev libasound2-plugins
sudo apt install libfftw3-3 libfftw3-dev
sudo apt install libspeex1 libspeexdsp1 libspeex-dev libspeexdsp-dev speex speex-doc
sudo apt install git autotools-dev autoconf libtool pkg-config

Clone the 2 Speex repos

git clone
cd speexdsp
./configure --libdir=/usr/lib/arm-linux-gnueabihf
sudo make install

Same procedure with speex.
git clone

blah blah…

You now have the actual releases of Speex and SpeexDSP installed.

So now we have to recompile alsa-plugins (current version) so that it doesn’t omit the speex plugins.

aplay --version
1.1.8 must likely

tar -xvzf alsa-plugins-1.1.8.tar.bz2
./configure --libdir=/usr/lib/arm-linux-gnueabihf
sudo make install

Create a /etc/asound.conf like something included in the start and your far field will work much better.
Don’t worry about when AGC ramps up gain and noise becomes a thing as recognition will just ignore and when voice of a required volume is spoken the AGC will ramp down so it doesn’t clip.
It will sound a terrible setup for studio recording but for recognition will work well.

Total pain having old versions of Speex in the repo that alsa will not compile as it references RC2 but we have RC1 but hey the release has been out for ages so at least we are up to date.

Echo seems to be totally useless dunno why as the working EC on github uses exactly the same libs.
Reverb never got completed so just have it off.

asound.conf software AGC can be pretty handy, a pain to install due to a repo mismatch but there you go.
As I just did a install myself and thought I would post before I forget again.

You may also want to run software EC which can be found here.

1 Like