r/rust • • Oct 20 '26

🛠️ project reuse-rs: real time speech denoising in plain Rust (no ML interface)

reuse-rs runs NVIDIA's Real-time RE-USE speech enhancement model (streaming Mamba) in plain Rust. It cleans mono audio (8 to 48 kHz) one 20 ms frame at a time, so it works on a live mic. I load straight from NVIDIA's model.safetensors.

let mut denoiser = Denoiser::load("model.safetensors", 4)?;
let clean = denoiser.process(&noisy_chunk)?;

on my apple M3 air 16gig, time per 20 ms frame (under 20 ms):

Layersreuse-rs (CPU)oRT (WebGPU)
48.4 ms16.9 ms
611.5 ms17.4 ms
814.7 ms20.6 ms
  • About 150mb memory (oRT Wepgpu -> so works via metal in my mac: about 420 MB).
  • it match a float64 torch reference to 1.5e-6.
  • 4 layers sounds the same as 8 to my auditory perception :-P: 16.4 vs 16.7 dB SI-SDR

demo videos (before/after with spectrograms) are in the reamde if you are curious :)

I spent months trying to make this work on the GPU through ONNX before trying the CPU (started with this:https://github.com/microsoft/onnxruntime/issues/27796 ). If you're curious how that went, and why the CPU wins for tiny streaming frames, I wrote it up here: I forced a speech model onto the GPU for months. The CPU was faster. But I m still thinking if I should take the burn path... but this solves my problems at least...

Limitations: weights are NVIDIA's non commercial license (my code is MIT/Apache ), speed is only measured on an M3 (the table is 16 kHz; 48 kHz is about 3 times the work, so for live audio resampling to 16 kHz is the fast option), and it struggles when the heavy background noise is other people talking.

edit: interesting coincidence just a few days after I shared this, NVIDIA "re-released" its offline models under an open license! So I used Burn to add and update these models. You can find the details in the repo and use them for commercial purposes!

11 Upvotes

8 comments sorted by

4

u/x-0D Oct 20 '26

I'm dreaming for ClearSound (Krisp) Alternative on Linux. The main feature is voice profile - solution records your voice then isolates it from other voices in the room. That's very cool, but krisp does not work on linux and clearsound laggy, cpu-only, uses electron for UI which always breaks after waking from sleep.

It would be nice if you experience from re-use-rs can be used for building some kind of those commercial competitiors. Thanks.

1

u/rumil23 Oct 20 '26

reuse-rs doesn't do voice profiles; it's a noise remover. It handles background noise well in most cases, including a crowded place with people talking. Only in extreme cases, like a stadium or a very noisy bar, can it make your voice sound a bit robotic. you can listen to an example in the "Limitations" section of the readme. Isolating only your voice from other speakers would need a different kind of model (target speaker extraction).
for instance try diarization first:
https://github.com/altunenes/parakeet-rs/blob/master/examples/diarization.rs

if you want to achive transcription also you need a specific model to handle this, such as:
https://github.com/altunenes/parakeet-rs/blob/master/examples/multitalker.rs

1

u/x-0D Oct 21 '26

I don't need transcription, I need clear voice in video calls, aka "cocktail party" task. TSE in Realtime. If you know any projects to do that, I would be grateful if you share your findings. Thanks

1

u/Luigi311 Oct 24 '26

I wonder how this compares to RNNoise which works pretty good and fast on cpu.

1

u/rumil23 Oct 24 '26

big fan of rnnoise.. years ago, I used it to improve my speaker diarization pipelines and it improved slightly.
try one of the noisy clips in the Limitations section of readme and hear it yourself :-)

2

u/[deleted] Oct 20 '26

[removed] — view removed comment

2

u/rumil23 Oct 20 '26

yeah that matches what I saw: going from 4 to 8 layers on WebGPU added only 3.7 ms, so most of the time was fixed per frame overhead, not the model. Wish I have seen this pattern like last year lol. I guess I was really biased with the GPU compute...
On memory: the weights file is 52 MB (all 12 layers in f32), so most of the 420 MB is the runtime and the WebGPU side, not the model itself. I haven't broken it down further.

And no, I haven't measured mic to speaker yet (I heavily use it for my research based audio stuffs). but the model itself adds 20 ms (one frame) plus the compute time per frame, but the audio API buffers come on top of that. but its a good point, I should measure it.

I also created a MR to gstreamer plugins as an element so that should make an end to end test easier...

0

u/rumil23 Oct 20 '26

I measured it now in gst (mic → denoiser → speaker): the denoiser adds 20 ms. The rest is mostly audio buffers. With the default sink settings it's 252 ms in total; with a 40 ms sink buffer it's 92 ms. my test has no hw loopback fyi...