Voice-engine / ec echo cancellation

Hi,

At a high level, I need the speaker to repeat what is said into a microphone. They need to be near each other. The obvious issue is the feedback / echo.

As I understand it - the solution is echo cancellation or Acoustic Echo Cancellation (AEC).

My hardware setup is:

I then done the following to setup things:

sudo apt-get -y install libasound2-dev libspeexdsp-dev
git clone https://github.com/voice-engine/ec.git
cd ec
make
cd ~
wget -c https://raw.githubusercontent.com/voice-engine/ec/master/asound.conf
mv asound ~/.asoundrc

Then I run the ec stuff:

./ec -i plughw:1,0 -o plughw:0

And finally connect the mic to the speaker via:

arecord -f dat - | aplay -

However I still hear an echo. It seems a little better than when I run the above without “ec”, but there is still an echo.

Any thoughts how to resolve this?

For your info. Here is the device lists:

pi@raspberrypi:~ $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
eci
eco
sysdefault:CARD=Audio
    USB Audio, USB Audio
    Default Audio Device
front:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Front speakers
surround21:CARD=Audio,DEV=0
    USB Audio, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Audio,DEV=0
    USB Audio, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
    USB Audio, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
    USB Audio, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
    USB Audio, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
    USB Audio, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
    USB Audio, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct sample mixing device
dsnoop:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct sample snooping device
hw:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Hardware device with all software conversions
pi@raspberrypi:~ $ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
eci
eco
sysdefault:CARD=sndrpijustboomd
    snd_rpi_justboom_dac, JustBoom DAC HiFi pcm512x-hifi-0
    Default Audio Device
dmix:CARD=sndrpijustboomd,DEV=0
    snd_rpi_justboom_dac, JustBoom DAC HiFi pcm512x-hifi-0
    Direct sample mixing device
dsnoop:CARD=sndrpijustboomd,DEV=0
    snd_rpi_justboom_dac, JustBoom DAC HiFi pcm512x-hifi-0
    Direct sample snooping device
hw:CARD=sndrpijustboomd,DEV=0
    snd_rpi_justboom_dac, JustBoom DAC HiFi pcm512x-hifi-0
    Direct hardware device without any conversions
plughw:CARD=sndrpijustboomd,DEV=0
    snd_rpi_justboom_dac, JustBoom DAC HiFi pcm512x-hifi-0
    Hardware device with all software conversions
sysdefault:CARD=Audio
    USB Audio, USB Audio
    Default Audio Device
front:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Front speakers
surround21:CARD=Audio,DEV=0
    USB Audio, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Audio,DEV=0
    USB Audio, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
    USB Audio, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
    USB Audio, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
    USB Audio, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
    USB Audio, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
    USB Audio, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct sample mixing device
dsnoop:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct sample snooping device
hw:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Hardware device with all software conversions