Is it possible to echo cancel for all devices? + A couyple of doubts about the module
Hi! I'm currently on Arch using pipewire 0.3.76, and I'm having some trouble getting around understanding/working with the echo-cancel module, sorry if these questions are too dumb.
First, I'm not sure how I'm supposed to use it, for example, if I just run:
pactl load-module module-echo-cancel
And start a WebRTC call, nothing seems to happen, and the mic grabs the speaker's voice (Discord), no difference so far..
But if I use this in my pipewire.conf file:
{ name = libpipewire-module-echo-cancel
args = {
library.name = aec/libspa-aec-webrtc
aec.args = {
webrtc.gain_control = true
}
# node.latency = 1024/48000
source.props = {
# This is the virtual input device available to applications.
# It will route the processed microphone signal to the application recording it.
node.name = "Echo Cancellation Source"
node.description = "Mic no echo"
}
capture.props = {
# This is where the raw local microphone signal is really coming from
# It should be connected to real local hardware microphones
#
# Note: node.name and node.description seem to be ignored for this stream (01/2023)
node.name = "Echo Cancellation MyCapture"
node.description = "Echo Cancellation MyCapture"
audio.channels = 2
audio.position = [ AUX7 AUX6 ]
target.object = "alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_797_2018_11_08_93567-00.analog-stereo"
node.passive = true
}
sink.props = {
# This is the virtual output device available to applications.
# It is what the communication application should use to play sound locally.
node.name = "Echo Cancellation Sink"
node.description "Speakers no echo"
}
playback.props = {
# This is the local speaker we are really sending the audio to that is coming from the application.
# Note that ideally this should be a real hardware audio output, that is on the same clock as the real hardware microphones!
node.name = "Echo Cancellation MyPlayback"
node.description "Echo Cancellation MyPlayback"
node.passive = true
audio.channels = 2
audio.position = [ AUX3 AUX2 ]
target.object = "alsa_output.pci-0000_0a_00.4.analog-stereo.3"
}
}
And set the Discord input as "No echo mic" and output as "Speakers no echo", echo cancellation works extremely well, and speaker's voice doesn't get sent at all, also voice sent sounds crisp, not filtered or robotic. Is this how it's supposed to work? Seems a bit too convoluted. Also, would it be possible to add, for example, any other audio source (music, video, etc) to the sources that get echo-canceled, or it only picks up what comes from the WebRTC call?
And one last question, would it also be possible to combine this echo-canceling module with other filters like, for example NoiseTorch? I thought that filtering the "No echo Mic" on Noisetorch and then selecting the NoiseTorch input as a source in the webrtc client would do the trick, but that way there is no echo-cancel, just NoiseTorch gate.
Sorry if these questions are out of scope and thanks for this!