PipeWire no longer honors the 'method' option for the echo-cancel module. Trying to use it will generate: aec.method is not supported anymore use library.name Remove it from all pipewire examples. It could be replaced by 'library.name=aec/libspa-aec-webrtc', but as that's currently the default (and only supported option), I've elided it. Co-authored-by: Omar Amin <65174210+omaramin-2000@users.noreply.github.com>
81 lines
2.2 KiB
Markdown
81 lines
2.2 KiB
Markdown
# Enabling Acoustic Echo Cancellation
|
|
|
|
Acoustic Echo Cancellation (AEC) is a type of sound processing used to cancel out the noise coming out of your speaker and going into your mic. In LVA this functionality can be useful to allow LVA to listen to wake words even when audio is playing, particularly when a timer is playing. PulseAudio and PipeWire already provide built-in modules for AEC.
|
|
|
|
## Enabling AEC
|
|
|
|
### PulseAudio
|
|
```sh
|
|
pactl load-module module-echo-cancel source_name=aec_mic aec_method=webrtc
|
|
```
|
|
|
|
To make permanent, add to `/etc/pulse/default.pa`:
|
|
```
|
|
load-module module-echo-cancel source_name=aec_mic aec_method=webrtc
|
|
```
|
|
|
|
### PipeWire
|
|
```sh
|
|
pw-cli load-module libpipewire-module-echo-cancel '{ source.props={ node.name=aec_mic } }'
|
|
```
|
|
|
|
To make permanent, add the following to the `context.modules` section of `/etc/pipewire/pipewire.conf`:
|
|
```
|
|
{ name = libpipewire-module-echo-cancel
|
|
args = {
|
|
source.props = { node.name = aec_mic }
|
|
}
|
|
}
|
|
```
|
|
|
|
Or if you are using a standard PipeWire installation without a custom `pipewire.conf`, create a new file inside `pipewire.conf.d/`:
|
|
```
|
|
context.modules = [
|
|
{ name = libpipewire-module-echo-cancel
|
|
args = {
|
|
source.props = { node.name = aec_mic }
|
|
}
|
|
}
|
|
]
|
|
```
|
|
|
|
## Using the AEC Input
|
|
|
|
In the `.env` file:
|
|
```
|
|
AUDIO_INPUT_DEVICE="aec_mic"
|
|
```
|
|
|
|
## Changing Source and Sink for AEC
|
|
|
|
### PulseAudio
|
|
```sh
|
|
pactl load-module module-echo-cancel source_name=aec_mic aec_method=webrtc source_master=<mic-source> sink_master=<sink>
|
|
```
|
|
|
|
### PipeWire
|
|
```sh
|
|
pw-cli load-module libpipewire-module-echo-cancel '{ source.props={ node.name=aec_mic node.description="Echo Cancelled Mic" } sink.props={ node.name=aec_sink } capture.props={ node.name=<your-mic-node-name> } playback.props={ node.name=<your-speaker-node-name> } }'
|
|
```
|
|
|
|
To make permanent, add to `context.modules` in `/etc/pipewire/pipewire.conf` or a file in `pipewire.conf.d/`:
|
|
```
|
|
{ name = libpipewire-module-echo-cancel
|
|
args = {
|
|
source.props = {
|
|
node.name = aec_mic
|
|
node.description = "Echo Cancelled Mic"
|
|
}
|
|
sink.props = {
|
|
node.name = aec_sink
|
|
}
|
|
capture.props = {
|
|
node.name = <your-mic-node-name>
|
|
}
|
|
playback.props = {
|
|
node.name = <your-speaker-node-name>
|
|
}
|
|
}
|
|
}
|
|
```
|