Add livekit-plugins-rnnoise (OSS self-hosted noise cancellation)#6477
Open
apoorva-01 wants to merge 8 commits into
Open
Add livekit-plugins-rnnoise (OSS self-hosted noise cancellation)#6477apoorva-01 wants to merge 8 commits into
apoorva-01 wants to merge 8 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, if you're self-hosting, there's not really a good built-in option for cleaning up mic noise. Krisp and ai-coustics both require LiveKit Cloud, so self-hosted users are kind of out of luck.
PR adds
livekit-plugins-rnnoise- which runs Xiph's RNNoise entirely on-device.No API keys, no model downloads, no signup required.
Usage is basically the same as the Krisp plugin:
This has been requested a few times already (#5507, #6033), and it pops up on the forum every now and then too.
Implementation-wise - it's pretty simple: incoming audio gets resampled into RNNoise's required 48kHz/480-sample format, denoised, resampled back, and returned at the exact same frame length it came in. Right now it's mono-only and has a simple
enabledflag. It talks directly to the nativelibrnnoiseviactypesinstead of usingpyrnnoise's Python wrapper, which keepsaudiolab,av, andmatplotlibout of the runtime path (and avoids theavversion pin).One small annoyance: the prebuilt native library currently comes from
pyrnnoise, but that package also declaresmatplotlibandaudiolabfor its CLI, sopipinstalls them even though this plugin never imports them. Not ideal. If you'd rather avoid those extra dependencies, I'm happy to vendorlibrnnoisedirectly or work with upstream to move the CLI dependencies behind an optional extra - whatever makes more sense.For testing, I added unit tests covering the mono guard, passthrough behavior, the same-length guarantee, actual noise reduction, and a regression test that catches anyone accidentally reintroducing the
audiolabimport. I also tested it in a live agent and on a few offline audio clips.make checkand the full unit test suite pass locally.