You can use pulse audio for echo cancelation.
https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Enable_Echo/Noise-Cancellation
sudo nano /etc/pulse/default.pa
### Enable Echo/Noise-Cancellation
load-module module-echo-cancel use_master_format=1 aec_method=webrtc aec_args="analog_gain_control=0\ digital_gain_control=1" source_name=echoCancel_source sink_name=echoCancel_sink
set-default-source echoCancel_source
set-default-sink echoCancel_sink
That should now set the default source to echo cancelled
pulseaudio -k
to kill pulseaudio the daemon should restart auto 1-2 secs most
From the Archwiki
Possible ‘aec_args’ for ‘aec_method=webrtc’
Here is a list of possible ‘aec_args’ for ‘aec_method=webrtc’ with their default values [4][5]:
-
analog_gain_control=1
- Analog AGC - ‘Automatic Gain Control’ done over changing the volume directly - Will most likely lead to distortions.
-
digital_gain_control=0
- Digital AGC - ‘Automatic Gain Control’ done in post processing (higher CPU load).
-
experimental_agc=0
- Allow enabling of the webrtc experimental AGC mechanism.
-
agc_start_volume=85
- Initial volume when using AGC - Possible values 0-255 - A too low initial volume may prevent the AGC algorithm from ever raising the volume high enough [6].
-
high_pass_filter=1
- ?
-
noise_suppression=1
- Noise suppression.
-
voice_detection=1
- VAD - Voice activity detection.
-
extended_filter=0
- The extended filter is more complex and less sensitive to incorrect delay reporting from the hardware than the regular filter. The extended filter mode is disabled by default, because it seemed produce worse results during double-talk [7].
-
intelligibility_enhancer=0
- Some bits for webrtc intelligibility enhancer.
-
drift_compensation=0
- Drift compensation to allow echo cancellation between different devices (such as speakers on your laptop and the microphone on your USB webcam). - only possible with “mobile=0”.
-
beamforming=0
- This can significantly reduce background noise. See [8][9]
-
mic_geometry=x1,y1,z1,x2,y2,z2
- Only with “beamforming=1”.
-
target_direction=a,e,r
- Only with “beamforming=1”. Note: If the module does not want to load with this argument, set azimuth (a) to the desired value, but set elevation (e) and radius ® to 0.
high_pass_filter=1
, voice_detection=1
, extended_filter=0
are questionable if the actual provide benefit.
VAD I thought is a Voice Active Detection filter but with nothing to use that signal prob pointless.
intelligibility_enhancer=0
isn’t implemeneted.
drift_compensation=0
Never tried.
I do use the rest and because I have a PS3 eye with a linear 4 mic array approx 20mm apart I have beamforming set. Noticed it seems to like an escape character of \ before the next parameter so my setup.
load-module module-echo-cancel use_master_format=1 aec_method=webrtc aec_args=“analog_gain_control=0\ digital_gain_control=1\ noise_suppression=1\ beamforming=1\ mic_geometry=-0.03,0,0,-0.01,0,0,0.01,0,0,0.03,0,0” source_name=echoCancel_source sink_name=echoCancel_sink