Elimination of noise and extraneous sounds

Tell me, how can you eliminate noise by recording simply through arecord or python audio?

There is ReSpeaker Core v2, there is Debian 11, Rhasspy and HLC, everything works fine, but there is a problem with recognition in noisy places, for example, music is playing or the noise of water in the bathroom or the noise of the TV. All these noises block normal recognition. I really liked this technology, but alas, it didn’t take off on Debian 11

But I managed to eliminate the noise according to this [instruction] (https://askubuntu.com/questions/18958/realtime-noise-removal-with-pulseaudio), I just don’t know how to use it in rhasspy.

pactl list sources short

Added an echo cancellation module

sudo nano /etc/pulse/default.pa
#Used to perform acoustic echo cancellation between a designated sink and source
load-module module-echo-cancel source_name=alsa_input.platform-sound_0.seeed-8ch source_properties=device.description=MicrofoneNoise
set-default-source MicrofoneNoise



I tested respeaker in various situations and I’ll tell you what, yes, it PULSE_PROP="filter.want=echo-cancel" /usr/bin/rhasspy --profile en 2>&1 works. I’m thrilled. It certainly does not work perfectly, but it is much better than without filtering. The speaker began to react in noisy places, which was not the case before. This is my subjective opinion and it may not coincide with yours, but I am impressed with how noise reduction works, even if it is not perfect, but it works the same

My scenarios are how I use the column and will be evaluated in points from 1 to 10.

The noise filter is turned off

  • My windows overlook the motorway and there is a lot of noise from cars coming from the street: activation 1 / speech recognition 3
  • TV works: Activation 0 / Speech recognition 1
  • Music playing: Activation 0 / Speech recognition 1
  • Bathroom water noise: Activation 0 / Speech recognition 1

The noise filter is on

  • My windows overlook the motorway and there is a lot of noise from cars coming from the street: activation 4 / speech recognition 6
  • TV works: Activation 3 / Speech recognition 3
  • Music playing: Activation 4 / Speech recognition 5
  • Bathroom water noise: Activation 2 / Speech recognition 4

In order for noise reduction to work automatically, you need to add to autorun

[Unit]
Description=Rhasspy Service
After=network-online.target

[Service]
Type=simple
User=respeaker
Group=respeaker
WorkingDirectory=/home/respeaker/.config/rhasspy/
ExecStart=/bin/bash -lc 'PULSE_PROP="filter.want=echo-cancel" /usr/bin/rhasspy --profile en 2>&1 | cat'

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rhasspy
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target

I can’t wait to see if this would work with the docker container. All my satellites use the docker container for quick rollout. But this… this could potentially make me rebuild them.

What I did is not quite right, yes, it started to work a little better, but it works unstable. It would be correct to add noise reduction to pyaudio hermess. I looked at the files in the rhasspymicrophone_pyaudio_hermes folder and did not find noise reduce in the code, and therefore there is no noise reduction in pyaudio hermess

There is a noise reduction library

There is a sample code for pyaudio

How would it be embedded in pyaudio hermess? I’m not a programmer and I don’t know how to embed it in pyaudio hermess so that speech recording is noise-free. I created a theme in the Rhasspy project, maybe there will be someone who knows how to embed noise reduction in pyaudio hermess