Noise cancellation

Post Reply
SlowLearner
Posts: 3
Joined: Wed Jan 07, 2026 5:58 am

Noise cancellation

Post by SlowLearner »

I think a noise-cancellation plugin would be ideal for Hudiy. USB mics aren't typically going to have any type of noise cancellation or high pass filter. Most are omni or cardioid too, which picks up everything in the environment. When on a phone call, people can't hear me at all at speed due to the amount of background noise. At slow cruise it's noise, but stopped is fine. This tells me it's not electrical interference, but road noise. Aftermarket headunits do a great job with this, such as the Pioneer that I've run in the same car.

Getting something like NoiseTorch and a high pass filter (100Hz or so) into the input chain (between the mic and echo cancel) would be ideal. I actually think it's necessary for a product like this. Is this something that could be done and made to be part of the installer? There don't seem to be any ready-to-go ARM64 builds that I can see.
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: Noise cancellation

Post by hudiy »

We will investigate the possibility of adding an external noise cancellation plugin. In the meantime, you can try the algorithms available within PipeWire itself (via WebRTC). It appears they are undocumented, but configuration parameters can be found in the PipeWire source code:

https://gitlab.freedesktop.org/pipewire ... =tags#L101

It should be possible to set them via aec_args in module-echo-cancel. module-echo-cancel is loaded from $HOME/.hudiy/share/hudiy_startup.sh

https://docs.pipewire.org/page_pulse_mo ... ancel.html
SlowLearner
Posts: 3
Joined: Wed Jan 07, 2026 5:58 am

Re: Noise cancellation

Post by SlowLearner »

Well... I passed the HPF and Noise suppression through via hudiy_startup.sh, and confirmed with:

Code: Select all

pactl list modules | grep -A25 echo-cancel
and got back:

Code: Select all

aec_args=voice_detection=false,high_pass_filter=true,noise_suppression=true
I noticed no appreciable difference in quality. I recorded a couple of test calls and it's amazing how much even minor background noise affects intelligibility. I'm open to more suggestions, as this is preventing me from implementing this in my car confidently. That's sad because I love all the other aspects of Hudiy! I'm even working on bringing in canbus data of Racecapture and Haltech for a custom lap timing display and gauges.
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: Noise cancellation

Post by hudiy »

We checked the documentation for NoiseTorch that you mentioned and looks like it can be run also from the command line.
Usage of ./noisetorch:
-c Check if update is available (but do not update)
-i Load supressor for input. If no source device ID is specified the default pulse audio source is used.
-l List available PulseAudio devices
-log
Print debugging output to stdout
-o Load supressor for output. If no source device ID is specified the default pulse audio source is used.
-s string
Use the specified source/sink device ID
-setcap
for internal use only
-t int
Voice activation threshold (default -1)
-u Unload supressor
Attached is the built (for Raspberry Pi OS Trixie) version v0.12.2 from GitHub (or you can build it yourself). You can load it, for example, from hudiy_startup.sh.

Assuming the binary was copied to $HOME:

Execute:

Code: Select all

sudo setcap 'CAP_SYS_RESOURCE=+ep' $HOME/noisetorch
Then in $HOME/.hudiy/share/hudiy_startup.sh you can add:

Code: Select all

$HOME/noisetorch -i -s "$EC_SOURCE"
To achieve the best noise cancellation results, you'll likely need to experiment with which source to choose for NoiseTorch (echo cancel vs. the sound card source) and set up the appropriate routing. You can configure the routing using qpwgraph, save it to a file and restore it (e.g., in hudiy_startup.sh) using:

Code: Select all

qpwgraph --minimized --activated --exclusive saved_routing.qpwgraph
Attachments
noisetorch.zip
(5.96 MiB) Downloaded 14 times
SlowLearner
Posts: 3
Joined: Wed Jan 07, 2026 5:58 am

Re: Noise cancellation

Post by SlowLearner »

Thank you for the detailed information, and for the Noisetorch build! Thanks especially for the following info:

qpwgraph --minimized --activated --exclusive saved_routing.qpwgraph

I couldn't figure out how to automatically load a routing scheme at startup and that made my life WAY easier. I would recommend adding that info to the wiki for those who are trying to achieve more advanced routing.

I tried Noisetorch and it didn't help at all (at first, more on this in a moment). Two days ago I was able to do some better testing. I routed the mic input (C-Media dongle that supports an electret mic) directly to the output and used closed-back headphones to listen directly to what the mic was picking up. A test drive showed what was happening. The mic input at 100% volume was clipping very badly from the low frequency (almost inaudible) road noise. Simply lowering the input volume 6dB-9dB solved the issue, which makes me think the issue was in the digital domain. The behavior was odd though, as the clipping just cut the signal entirely, rather than simply distorting.

Still, there were improvements to be made. So I did further testing with a high pass filter and noisetorch. My current input signal chain is now:

Mic input >>> High-pass Filter (100hz) >>> NoiseTorch (voice threshold at zero)

The high pass filter gives Noisetorch an easier time. Both together makes my voice incredibly clear to the person on the other end of the call. I left some test voice-mails and you can't even tell it's from a driving car. Excellent.

I hope this helps anyone wanting to make improvements to their input quality! If you are running into quality issues, start with headphones and listen directly to your input and go from there.
Post Reply