PulseAudio doesn't load after adding noise cancellation to config

6,917

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

Share:
6,917

Related videos on Youtube

Nitish Sharma
Author by

Nitish Sharma

Updated on September 18, 2022

Comments

  • Nitish Sharma
    Nitish Sharma over 1 year

    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.
    
    • Charles Green
      Charles Green over 5 years
      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
    • Nitish Sharma
      Nitish Sharma over 5 years
      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
    • Charles Green
      Charles Green over 5 years
      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.
    • Nitish Sharma
      Nitish Sharma over 5 years
      Nope, still the same issue after using just the line with source. Also typing "pulseaudio --start" in console leads to "Daemon startup failed."
    • Charles Green
      Charles Green over 5 years
      Have you checked the log files for why the daemon does not start? the gnome-logs program under 'applications' is a good starting point.
    • Nitish Sharma
      Nitish Sharma over 5 years
      Have one log stating that "[pulseaudio] bluez5-util.c: GetManagedObjects() failed: org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)". Also, a few say "[pulseaudio] pid.c: Daemon already running."
    • Charles Green
      Charles Green over 5 years
      yeah, there's lots of stuff in the logs... Try this: In a terminal, execute pulseaudio --kill then pulseaudio --start then sudo journalctl -xe | tail -25
    • Charles Green
      Charles Green over 5 years
      Append the results of the journalctl command to your question (edit them in...)
    • Charles Green
      Charles Green over 5 years
      Alternatively, you could run pulseaudio -v (adding more 'v''s if needed) to get some error messages
    • Nitish Sharma
      Nitish Sharma over 5 years
      couldn't kill the process as it wasn't active but I did all you asked
    • Charles Green
      Charles Green over 5 years
      K - I'm about out of options, although the module_echo_canced is the culprit. I'd edit your /etc/pulse/default.pa to just load-module module-echo-cancel, see if it works, and then build up from there.
    • Nitish Sharma
      Nitish Sharma over 5 years
      Thanks for the help, as I stated I had started my first attempt with just "load-module module-echo-cancel". All I had to do was change to hardware profile to Analog Stereo Duplex.
  • Charles Green
    Charles Green over 5 years
    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!