pulseaudio – Automatic switching of source port with and without module-echo-cancel

I am running Ubuntu Mate 20.04 and I am trying to set up my audio devices on my laptop. I learned about module-echo-cancel and am now using it.

I have added the following to the pulse audio configuration near the end:

.ifexists module-echo-cancel.so
# https://wiki.archlinux.org/title/PulseAudio#Microphone_echo/noise_cancellation
load-module module-echo-cancel use_master_format=1 use_volume_sharing=1 aec_method=webrtc aec_args="analog_gain_control=0 digital_gain_control=1 experimental_agc=0 noise_suppression=1 voice_detection=1 extended_filter=1" source_name=echoCancel_source sink_name=echoCancel_sink
set-default-source echoCancel_source
set-default-sink echoCancel_sink
.endif

I have since noticed that I can not set the port for this source in the GUI as I can with the default source. I have 2 sources. “Built-in Audio Analog Stereo” and Monitor of Built-in Audio Analog Stereo when I don’t have the module loaded.

Without module-echo-cancel, when I plug in my headset into the mixed input and output 3.5mm jack, the audio sink connector switches from Internal to Headset. This is most likely because the module module-switch-on-port-available is loaded. However when I plug the same headset into the 3.5mm jack the audio source does not automatically switch over. How can I achieve that?

With the echo cancel module it takes the selected audio port and applies it’s filter to that. However I have to do 4 clicks to change it. First switching back to the unfiltered input, then switching the port and then switching back to the filtered input. Whenever I unplug my headset it switches back to the internal microphone, which has a very poor quality.

How can I switch automatically to the new source port? How can I make echo cancel automatically use the new source port if that is a different thing?

I have read through the pulseaudio documentation on freedesktop and the arch wiki, but I have found nothing that would help me. I thought module-switch-on-port-available would do it, but it was already loaded. It switches only the output ports automatically, not the input.

Pulse detects the headset microphone as it populates the drop down list in the gui, but it does not switch automatically.

Read more here: Source link