Just do as it says.
sudo apt-get -y install libasound2-dev libspeexdsp-dev
git clone https://github.com/voice-engine/ec.git
cd ec
make
Install the alsa fifo
git clone https://github.com/voice-engine/alsa_plugin_fifo.git
cd alsa_plugin_fifo
make && sudo make install
Copy the asound.conf to /etc/
Run ec in cli console ./ec -i plughw:1 -o plughw:1 -d 75 -f 2048
In another cli console arecord -fS16_LE -r16000 rec.wav
In another cli console aplay file_example_WAV_10MG.wav
When you stop recording you will notice EC ends.
So to make it permanent you will just have to sort the pcm names and device names but using examples
sudo modprobe snd-aloop
arecord -D my-ec-output | aplay -D aloop,dev0
Make aloop,dev1
the default capture and ec will always record but only kick on on media play.
I think there is prob a slight mistake in the code ec.c where the small 10ms filter_frame should be a power of 2 (128, 256 or 512) as FFT like it that way. 10ms of 16000hz is between 128 & 256 but speex seems to think 20ms and why maybe I think 256 sounds a little better and 512 seems to work OK aswell.
He has actually set the filter_tail to a power of 2 and actually that doesn’t matter so much, but no harm in keeping to the power of 2 .
So maybe do a hard edit and make.
So it all works via alsa, kicks in when only media is played and with the loopback will not need a restart on each recording end.
Only thing I did any different as noticed debian speex & speexdsp are quite old and an RC I just downloaded the tar and compiled and installed the 1.2.0 release before making EC.
If someone can provide a working latency measurement of that arrangement, it would be really appreciated as my 75ms delay is a total guess.
I tried the alsabat --roundtriplatency
and couldn’t seem to get it to work but it does with straight hardware. Also prob wouldn’t be correct because we have a pipe through a loopback after EC.
Again once more my annoying voice but a default install of ec without any tinkering on a Pi4 should sound like this.