Noise cancelling?

I was playing with shairport-sync on one of my rhasspy installs and I was wondering if anyone knows if it’s possible to do audio cancelling via software or hardware that would feed the audio that’s being played out the speakers back into the mic to cancel out the speaker audio. I think this is how stuff like alexa and google home can still take commands when music is playing.

Just a random thought and figured i would see if anyone knows if that’s feasible in our DIY realm or if that’s going far into commercial land lol

Also in pulseaudio and pipewire has a new implementation of webrtc-aec think nonlinear also but have to check pipewire out seems to be implemented on Debian 11 which is my new fave from Ubuntu but haven’t looked yet as think its partial as runs in conjunction with pulseaudio.

@sanebow did a great job of Pi-ising GitHub - SaneBow/PiDTLN: Apply machine learning model DTLN for noise suppression and acoustic echo cancellation on Raspberry Pi

Also mic isolation and don’t use hat based mics as they are near impossible to isolate pcb mounted mics not on a daughter board or wired.
Then also don’t use omnidirectional but what phones used for decades of old tech of unidirectional rear ported electrets that cancel equal noise received at the front which is a local effect only but for local speakers and device as was with phones worked well for decades.
The vibration transmission through non isolated enclosures is absolutely huge and a mountainous task for any EC where the sound ratio of SNR is pitiful but could been of averted by firstly implementing some sort of isolation before even getting to good design.
Its why Google and Amazon have internal ridgid steel structures with daughter board isolated microphones and whats inside you might find surprising but it has to be ridgid to stop resonance transmission and how important that is can be seen in material investment.

Also plugins for speex need a recompile as Debian for some reason for a while now has a RC version of speex whilst libasound is the release version but never did get it right really.
Speex for me works best as its not echo cancellation but echo attenuation but continues at much higher SNR (sound to noise ratio) than webrtc that works great then just fails at relatively modest levels.

I also keep meaning to hack the ec speex code and have areally short frame and tail so its not so much echo (dereverb) but simple linefeedback cancellation in a hope that might be even more effective with direct fed reference systems.

From speaker to mic of your device its Echo Cancellation noise elsewhere is noise cancellation.

PS my little DiY test rig of 2x wired unidirectional mics works mighty as each is an additional process as the natural noise suppression will work in conjunction with EC to provide an overall effect that will surpass software alone.


Electrets are round and its very easy to drill a hole and squeeze into a rubber grommet as not Google standard but at least it employs some design to a complete lack provide by open pcb gpio mounted hats.
Even had to drill another hole as cut my wires too short but just an example and used with a stereo ADC that is £5.99 needs no drivers and has hardware AGC.
https://www.scan.co.uk/products/enermax-ap001e-dreambass-usb-soundcard-plus-earphones-genie-with-integrated-80-hz-plus6-db-bass-boos

2 Likes