Echo cancellation [resolved]

How can i cancel the acoustic echo while piping record and play?

am using onboard mic and speaker, (ULTRA++)
i can not pipe with this code:
sudo arecord -f cd -Dhw:0 | aplay -Dhw:0

Echo and loud noise!

Hi Abouzar and welcome,

By definition playing what is recorded will create and audio loop and so echo, the easier way will be to lower the gain of your microphones or lower the volume of the speakers. Another solution is to use an external microphone that is more directive such as a cheap mic - headphone used by gamers and Zoom calls (the kind with 2 jacks)

A much more complex idea would be to use one of the onboard microphone for noise cancellation but not sure that the 2 microphones are enough separation for this to work : https://www.cloudacm.com/?p=3180