6 ms·
Show HN: Alsa_rnnoise – RNNoise-based noise removal plugin for ALSA
- cristyansv 6y agolooks promising. but I've always wondered how Krisp.ai achieves such good results, considering that it works on the local device, plus the size is quite small (a few hundred MB). it really impresses me. disclaimer: I'm not affiliated in any way with Krisp.ai, just a happy user.
- ArsenArsen 6y agoEver since I got a new microphone I've been having issues with large quantities of background noise, primarily typing sounds, leaking in through my microphone. A friend of mine had told me about rnnoise, describing it as "very good" at removing noise, so I decided to test it. My initial testing started by me piping raw PCM from arecord through rnnoises denoiser demo into aplay. The results frankly shocked me. When not speaking, there was no noise (or sound) at all (this is due to rnnoises voice detection system, which essentially mutes the microphone when there's no voice), and when I was talking, the sound of my keyboard was a lot quieter without it affecting my voice, this lead me to decide to develop alsa_rnnoise to have good real time noise cancellation. alsa_rnnoise is a very simple ALSA filter plugin that runs its input through rnnoise before outputting it back to ALSA. It operates in real time, adds very little latency (the amount depends on what size frames ALSA delivers, but is nominally less than 10ms). After enabling it, any annoying background sounds were gone. My intended use cases for this were VoIP, screencasting and streaming, and, as far as I can tell, it works great for all three.
- drblah 6y agoA few weeks ago, I tried doing this with the LADSPA version of RNNoise and ALSA, but couldn't get it to work reliably. I have also experimented with NoiseTorch which routes the microphone through LADSPA using Pulseaudio but it didn't work reliably either. The biggest problem with this is that Pulseaudio will load one CPU thread 100% even when no audio input. This makes it a deal breaker for laptops. I will definitely check this out. RNNoise is truly amazing tech, but it is not as accessible as I would like. The best use if it is in the Mumble client where it is an optional setting. It is a shame Nvidia has taken over this space completely with RTX voice. RNNoise does a comparable job without the need for an Nvidia GPU. But I guess it is because RNNoise is just not as easy to setup.
- ArsenArsen 6y agoI believe Pulse also has a LADSPA module that you could try.
- onli 6y agoHey, thanks for building this! There are multiple options like this for Pulseaudio, but last I researched it nothing for pure ALSA. On a system without Pulseaudio this is obviously better, great to have. The pulseaudio plugins like noisetorch have the issue of significant system load even without current sound input (something about how the loopback works iirc), will this alsa plugin share that issue or will the system load be lower when currently there is no sound input?
- deleted 6y ago[deleted]
- ArsenArsen 6y agoThe plugin uses very little CPU, and is entirely inactive when not in use (i.e. when data isn't being pulled => the transfer function isn't being called) due to how ALSA works EDIT: Do note, though, that each process pulling audio will be denoising independently, so the usage scales linearly with the amount of clients. This is due to how ALSA plugins work, but regardless of that, on a Ryzen 5 1600x (the only CPU I can test on), the plugin uses 2.5% of a single core when recording mono 48k
- onli 6y agoExcellent. I'm testing this right now and am noticing that some more info about the installation could be helpful. Specifically, when installing rnnoise as shown in the readme it of course goes to /usr/local/lib, but /usr/local/lib/pkgconfig was not in the PKG_CONFIG_PATH of my distro. Maybe there could be a hint to set that when calling `meson build` if rnnoise can't be found? Packaging software is always annoying, sorry for dragging you into that mud. Ideally distros will pick it up and compiling manually unnecessary. I would have left this as an issue but saw no issue tracker on the project page.
- ArsenArsen 6y agoThere's an issue tracker on that page, under tickets, but I'd prefer if you took a discussion to the attached mailing list first before it hits the official tracker. As for packaging, that's my field of work for some projects I'm working on so it's not unfamiliar to me, the only problem is that the RNNoise upstream lacks releases, although there's discussion about something happening about that.
- spion 6y agoI'm intrigued by this. I've never been really satisfied with any software noise reduction system, but this sounds like a phenomenal improvement. Tried installing it on Ubuntu LTS via latest pulseeffects, but it seems like it switched to pipewire 0.3 which is not available yet so I can't really run it. My solution so far has been a headset with a boom microphone, like the CoolerMaster MH630 (one of the better boom mics, see https://www.rtings.com/headphones/reviews/cooler-master/mh630 https://www.rtings.com/headphones/reviews/cooler-master/mh63... for a sound demo at the "Recording quality" section). When it comes to noise reduction, bringing the microphone as close to the mouth as possible is a really good way to get an amazing SNR boost immediately (even for omnidirectional mics). Unfortunately that's a pain with large capsule condenser microphones (unless you're ready to have a large boom arm hanging about on your desk and accept view obstruction, and you add postprocessing to remove the very bassy proximity effect) Another benefit of headsets with boom mics is consistency (without DSP). No matter how you move, the distance and angle to the microphone is always identical, and therefore the sound is very consistent (save for your own personal loudness) You can of course add DSP (limiter, noise reduction etc) to that, but the better input you provide, the better output you get.
- pabs3 6y agoI noticed that RNNoise doesn't appear to be an open model, you can't re-train it from scratch from the source data, which isn't publicly documented (or doesn't exist?), even if you had enough hardware.
- ArsenArsen 6y agoThe documentation is a bit poor. The original data is available for download (with more info about the entire process, most of which is outside of my grasp as I am not an ML person) in the demo blog post: https://jmvalin.ca/demo/rnnoise/ https://jmvalin.ca/demo/rnnoise/ (towards the bottom of the page)
- pabs3 6y agoAny idea about the license for the original data?
- pabs3 6y agoThe paper links to the McGill TSP speech database (English & French) as one of the sources of the data, which claims to be BSD licensed: http://www-mmsp.ece.mcgill.ca/Documents/Data/ http://www-mmsp.ece.mcgill.ca/Documents/Data/
- pabs3 6y agoThe other source of data mentioned in the paper is the NTT Multi-Lingual Speech Database for Telephonometry, which seems to be commercial, so presumably under a proprietary license. https://www.ntt-at.com/product/multilingual/ https://www.ntt-at.com/product/multilingual/ https://www.ntt-at.com/product/speech2002/ https://www.ntt-at.com/product/speech2002/
- pabs3 6y agoHmm, OTOH, the 6.4GB data tarball says that it is from contributors who responded to the demo and is licensed under CC0.
- 6y ago
- methyl 6y agoFor PulseAudio, there is https://github.com/lawl/NoiseTorch https://github.com/lawl/NoiseTorch
- adgjlsfhk1 6y agoJust installed it. It is great! Thanks for the recommendation.
- kevincox 6y agoI would recommend PulseEffects. It has a much nicer UI than NoiseTorch, supports a number of effects besides noise cancellation (if desired), supports auto-start, supports custom models (but has a good default included), doesn't require a sudo password and doesn't burn CPU if your mic isn't being used. The support in PulseEffects is new but has been working well for me. I have had zero issues and don't even think about it anymore.
- the_real_sparky 6y agornnoise is fantastic. I use it in an Equalizer APO filter chain on my gaming machine along with an EQ and compressor which are fed from a dynamic mic. I consistently get comments about the quality of my mic setup in-game and on Discord. The best part is that it has almost no impact on voice quality, unlike Krisp and some other options I have tried. Singing into the filter chain even sounds good, with the exception of when my 5 year old daughter joins in. rnnnoise seems to think that her voice is noise and tries to intermittently filter it out, which causes a volume warble while we sing together. To be fair, 99.9% of the time her voice should definitely be considered noise I want filtered out. ;)
- dgellow 6y agoIf you're using Windows, I recently found it this small tool to reduce background and keyboard/mouse noises: https://closedlooplabs.com https://closedlooplabs.com. It's not open source as far as I'm aware but way cheaper than krisp.ai's subscription model.
- ArsenArsen 6y agoIt is possible to use VST2 on Windows. This way you get RNNoise and the advantages of Free software. https://github.com/werman/noise-suppression-for-voice https://github.com/werman/noise-suppression-for-voice
- syntaxing 6y agoIs there any RNNoise based alternative for MacOS? I managed to install the plug-in but find it hard to pipeline the audio into it.
- ZoomZoomZoom 6y agoSound engineer here. RNNoise is an amazing feat, but please, don't overdo it. Most of the time, you don't really want complete ambient noise elimination, as human speech appearing from dead silence sounds unnatural. Moreover, most noise reduction software is considerably less effective in reducing noise during a person speaking, either removing too much, producing degraded speech sound (worst case) or too little. If it's possible, always start adding your noise reduction gradually, stop when it sounds good to your ear and then back up a bit. If you're doing voice recording/streaming, please, get to know Expanding and Compression first, and only after configuring your sound processing chain add noise reduction in. On of the serious offenders is OBS studio, which recently added RNNoise filter, but provides no means of mixing processed sound with the dry one (in other words, filter is always 100% on). Wet/Dry mix knob is heavily needed for most filters there. I'm very saddened by the state of sound quality in lots of amazing videos people have been producing lately and now I'm considering writing a guide for voice processing for streams/conferences/etc for the techy people, if anyone's interested.
- ArsenArsen 6y agoI'd be quite interested in such an article, again, my goal (besides VoIP) is screencasting and/or streaming, so any bit of advice someone with experience might have is greatly useful. I'll look into expansion and compression, and I could implement a wet/dry setting that multiplies the source samples and then mixes them into the result, if I understood the concept right. EDIT: RNNoise seems to be alright when it comes to canceling noise during speech too, I didn't notice it overdoing it.
- ZoomZoomZoom 6y ago> I could implement a wet/dry setting that multiplies the source samples and then mixes them into the result, if I understood the concept right. Haven't tested your version yet, but werman/noise-suppression-for-voice plugin introduces some delay and dumb wet/dry control (or mixing with original sound source in some other way) doesn't work, so it might turn out to be not so simple.
- 6y ago
- PostThisTooFast 6y agoWhat's "ALSA?"
- sprash 6y agoIs there something like a GUI that generates .asoundrc files? The syntax is not exactly intuitive.
- ArsenArsen 6y agoThere's no GUI for it, but I'm willing to help you with it. If you have no asoundrc (i.e. you let ALSA figure it out for you) the example in the README will work. Otherwise you can email me or post on the mailing list and I can get back to you.
- sprash 6y agoRight now I have multiple capture devices (front mic, rear mic, capture) which can be selected in alsamixer via "Input source". It would be great to have another "virtual" capture device that uses e.g. front mic but routed through rnnoise so that rnnoise can be easily turned on/off by selecting the input source. Unrelated to this I want to be able easily switch between my Headphones and HDMI output whereas HDMI out needs to be routed through dmix->alsaequal->softvol->HDMI. I gave up after spending two hours tinkering.
- ArsenArsen 6y agoI'm pretty sure the switch you're talking about is hardware level. If you want to turn rnnoise on/off you could create a new pcm rather than overriding the default, and then having the software select it. The README example of asoundrcs is for the most part the same, you'd just remove this secion: pcm.!default { type asym playback.pcm "cards.pcm.default" capture.pcm "rnnoise" } As for the second thing, you could do what I do and use pcm_jack, like this: pcm.!default { type asym playback.pcm "plug:jack" capture.pcm "plug:rnnjack" } pcm.rnnjack { type rnnoise slave.pcm plug:jack } Keep in mind this will need more setup, specifically to set JACK up, and is definitely overkill, but may be fun. Also, this config is how my setup works exactly.
- hendry 6y agoJust tried the pulseaudio https://github.com/lawl/NoiseTorch https://github.com/lawl/NoiseTorch and I must say it makes an astonishing difference: https://www.youtube.com/watch?v=5rAfyMrE49o&feature=youtu.be https://www.youtube.com/watch?v=5rAfyMrE49o&feature=youtu.be Though basics of getting dynamic microphone close to my mouse is probably bigger, hah