0

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.
  • The set-defaults seem to be off to me, but I think you might try as recommended in https://askubuntu.com/questions/18958/realtime-noise-removal-with-pulseaudio – Charles Green Jan 11 at 17:29
  • That was actuall my first attempt after just googling "noise cancellation pulseaudio". Then I stumbled upon the wiki and gave that a shot. Also I reinstalled alsa-base and pulseaudio between the two attempts just to be sure – Nitish Sharma Jan 11 at 17:43
  • My confusion is from setting the source and sink to the cancellation module - I would naively think that doing one or the other (the souce) would be sufficient, but that using both may lead to a loop. – Charles Green Jan 11 at 17:46
  • Nope, still the same issue after using just the line with source. Also typing "pulseaudio --start" in console leads to "Daemon startup failed." – Nitish Sharma Jan 11 at 17:58
  • Have you checked the log files for why the daemon does not start? the gnome-logs program under 'applications' is a good starting point. – Charles Green Jan 11 at 18:11
1

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)”

  • I modified your answer to include the relevant text from the link: AskUbuntu dislikes answers which link to other websites, as the content of those sites can change without notice. Please be sure to come back in a day to mark your own answer as 'Accepted', and welcome to AskUbuntu! – Charles Green Jan 11 at 21:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.