Ubuntu – PulseAudio doesn’t load after adding noise cancellation to config

alsamicrophonepulseaudiosound

I am new to linux and want to use it as my daily driver however, I want noise cancellation for my mic and after some googling, I found out that you can edit the pulseaudio config file to load the specific module for it as shown in this :-

https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Enable_Echo/Noise-Cancellation

So I opened terminal, typed

sudo nano /etc/pulse/default.pa

and then added the lines

 ### 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

after that, I rebooted my computer but everytime I did something related to voice recording made my computer freeze for about a second (like going to Settings->Sound, starting a voice recording in Counter Strike Global Offensive, testing microphone in steam etc…).

Then I opened pavucontrol and saw this :-

Screenshot of pavucontrol

Does anyone have a clue as to what I am doing wrong?

Running sudo journalctl -xe | tail -25 gives the following result :-

Jan 12 00:26:12 nitish-Linux obexd[2392]: OBEX daemon 5.48
Jan 12 00:26:12 nitish-Linux dbus-daemon[1390]: [session uid=1000 pid=1390] Successfully activated service 'org.bluez.obex'
Jan 12 00:26:12 nitish-Linux systemd[1185]: Started Bluetooth OBEX service.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit UNIT has finished starting up.
-- 
-- The start-up result is RESULT.
-- Reboot --
Jan 11 23:54:43 nitish-Linux pulseaudio[2494]: Can't cancel echo between a sink and its monitor
Jan 11 23:54:43 nitish-Linux pulseaudio[2494]: Failed to load module "module-echo-cancel" (argument: "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"): initialization failed.
Jan 11 23:54:43 nitish-Linux pulseaudio[2494]: Module load failed.
Jan 11 23:54:43 nitish-Linux pulseaudio[2494]: Failed to initialize daemon.
Jan 11 23:55:15 nitish-Linux pulseaudio[2515]: [pulseaudio] module-echo-cancel.c: Can't cancel echo between a sink and its monitor
Jan 11 23:55:15 nitish-Linux pulseaudio[2515]: [pulseaudio] module.c: Failed to load module "module-echo-cancel" (argument: "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"): initialization failed.
Jan 11 23:55:15 nitish-Linux pulseaudio[2515]: [pulseaudio] main.c: Module load failed.
Jan 11 23:55:15 nitish-Linux pulseaudio[2515]: [pulseaudio] main.c: Failed to initialize daemon.
Jan 11 23:55:15 nitish-Linux pulseaudio[2512]: [pulseaudio] main.c: Daemon startup failed.
Jan 12 00:10:30 nitish-Linux pulseaudio[3085]: [pulseaudio] module-echo-cancel.c: Can't cancel echo between a sink and its monitor
Jan 12 00:10:30 nitish-Linux pulseaudio[3085]: [pulseaudio] module.c: Failed to load module "module-echo-cancel" (argument: "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"): initialization failed.
Jan 12 00:10:30 nitish-Linux pulseaudio[3085]: [pulseaudio] main.c: Module load failed.
Jan 12 00:10:30 nitish-Linux pulseaudio[3085]: [pulseaudio] main.c: Failed to initialize daemon.
Jan 12 00:10:30 nitish-Linux pulseaudio[3082]: [pulseaudio] main.c: Daemon startup failed.

Best Answer

I found the solution to it, before editing the config file, I had to make sure that the hardware for built-in Audio was configured with the profile "Analog Stereo Duplex", I had it on "Analog Stereo Output" as pointed out by :-

https://forum.manjaro.org/t/sound-problems-since-last-stable-update/30773/22

E: [pulseaudio] module-echo-cancel.c: Can’t cancel echo between a sink and its monitor

Pulseaudio failed to start because module-echo-cancel couldn’t find microphone input.

If only available input device is the monitor of the output sink, better to have pulseaudio fail with error than try to use 2 identical signals for echo cancellation. I accidentally created similar situation by connecting a balanced microphone signal to a stereo line - pulseaudio remixed the balanced hot and cold to mono for skype calls, all callers heard was silence because remixing the 2 out of phase signals cancelled everything, but it still looked like it was working in Pulseaudio Mixer.

Now you have Pulseaudio started, can try to add extra module back in with terminal command:

pactl load-module module-echo-cancel

If you still get same error, check Pulseaudio Mixer is showing device is set to ‘Duplex’ to allow audio input and output, also check output device is not showing as “(unplugged)”

Related Question