Yankcord's voice chat currently relies entirely on browser-native noiseSuppression via getUserMedia constraints. Browser-native suppression handles steady-state noise (fans, AC) but struggles with transient noise (keyboard clicks, dogs, etc.). Integrating RNNoise — a neural-network-based noise suppressor compiled to WebAssembly — will provide significantly better noise suppression comparable to Discord's Krisp integration. The WASM+AudioWorklet approach runs in-browser so it works identically in both the web client and the Tauri desktop client (WebView2).
Approach
Use the @sapphi-red/web-noise-suppressor npm package. It provides a ready-made RnnoiseWorkletNode (AudioWorkletNode subclass) backed by @shiguredo/rnnoise-wasm. This gives us:
Pre-built WASM binaries (including SIMD variant for browsers that support it)
An AudioWorklet processor that handles the 480-sample frame requirement of RNNoise internally
A clean AudioWorkletNode API that drops into our existing Web Audio graph
The existing "Noise suppression" toggle in settings will be repurposed: when ON, it enables RNNoise (and disables browser-native noiseSuppression to avoid double-processing). When OFF, neither is active. This keeps the UX identical — one toggle, better quality.
Files to Modify
1. client/package.json
Add dependency: @sapphi-red/web-noise-suppressor
2. client/vite.config.ts
Configure Vite to handle the worklet file and WASM assets from the package (may need optimizeDeps.exclude or asset copy configuration)
3. client/src/api/media/rnnoise.ts (NEW)
Module to manage RNNoise lifecycle:
initRnnoise(audioContext: AudioContext): Promise<RnnoiseWorkletNode> — registers the AudioWorklet module and creates the node
disposeRnnoise(node: RnnoiseWorkletNode) — disconnects and cleans up
Caches the worklet registration so it only loads once per AudioContext
Handles errors gracefully (if WASM fails to load, fall back to no suppression)
4. client/src/api/media/microphoneProcessing.ts
Insert the RNNoise worklet node into the processing chain:
Current chain: sourceNode → gainNode → destination
New chain:
Assistant
I'll start by reading the relevant files to understand the current codebase structure, then implement the changes.
Assistant
Now let me read all the relevant files in parallel.
User
[Request interrupted by user]
User
/model
model
User
Continue
Assistant· claude-sonnet-4-6
Now let me check the memory file and look up the package API.
Assistant· claude-sonnet-4-6
Let me check the package structure by looking at its GitHub source.
Assistant· claude-sonnet-4-6
Now let me check how createProcessedMicrophoneTrack is called to understand if making it async is feasible.
Assistant· claude-sonnet-4-6
Let me read the full context of the callers.
Assistant· claude-sonnet-4-6
Now I have a complete picture. Let me implement all the changes.
Assistant· claude-sonnet-4-6
Now update both callers to await and pass the new parameter:
Assistant· claude-sonnet-4-6
Now update devices.ts:
Assistant· claude-sonnet-4-6
Now update constraints.ts to always set noiseSuppression: false (RNNoise handles suppression now):
Assistant· claude-sonnet-4-6
Now let's verify — typecheck first, then build:
Assistant· claude-sonnet-4-6
Typecheck passes. Now let's verify the build:
Assistant· claude-sonnet-4-6
Build succeeds. Let me verify both WASM variants were included:
Assistant· claude-sonnet-4-6
Both WASM files are identical in this package version (same hash = Vite correctly deduplicated them). The build is good.
Now I need to wire up updateRnnoiseEnabled to the settings toggle so it takes effect dynamically. Let me find where the noise suppression setting is saved:
Assistant· claude-sonnet-4-6
Now update the SettingsPage.tsx to use dynamic updateRnnoiseEnabled instead of restarting the mic:
Assistant· claude-sonnet-4-6
Now run typecheck and build one more time to confirm everything is clean:
Assistant· claude-sonnet-4-6
Both checks pass. Let me save notes to memory:
Assistant· claude-sonnet-4-6
All done. Here's a summary of what was implemented:
create a new branch and commit all the changes we just did
Assistant· claude-sonnet-4-6
There are many pre-existing changes on this branch. I'll create a new branch and only stage the files we touched in this session.
Assistant· claude-sonnet-4-6
Done. Created branch feat/rnnoise-noise-suppression with the commit 6d4df28 containing only the 10 files from this session — the pre-existing changes on feat/dxgi-capture-rework were left unstaged.
sourceNode → rnnoiseNode → gainNode → destination
Add rnnoiseNode to the MicrophoneProcessingSession interface
In createProcessedMicrophoneTrack(): if noise suppression is enabled, create and insert the RNNoise node; otherwise, wire directly as today
In disposeMicrophoneProcessing(): disconnect and clean up the RNNoise node
Add updateRnnoiseEnabled(enabled: boolean) export to dynamically bypass/enable the node (disconnect/reconnect in the chain) without restarting the mic
5. client/src/api/media/constraints.ts
When RNNoise is enabled, set browser-native noiseSuppression to false in audioInputConstraint() to avoid double-processing
Update the "Noise suppression" description text to reflect the improved quality (e.g., "AI-powered noise suppression that reduces background sounds including keyboard clicks and ambient noise")
No new toggles needed — the existing toggle controls RNNoise
7. client/src/stores/settings.ts
No changes needed to the settings store itself — voiceNoiseSuppressionEnabled already exists and controls the feature
Implementation Details
Audio Chain Integration
code
getUserMedia(noiseSuppression: false) ← disable browser-native when RNNoise active
→ AudioContext.createMediaStreamSource()
→ RnnoiseWorkletNode ← NEW: neural noise suppression
→ GainNode ← existing: volume control
→ MediaStreamDestination ← existing: output to mediasoup
RNNoise Module (rnnoise.ts)
typescript
import { RnnoiseWorkletNode } from "@sapphi-red/web-noise-suppressor";
// Import worklet processor URL and WASM binary URL using Vite's ?url import
export async function createRnnoiseNode(audioContext: AudioContext): Promise<RnnoiseWorkletNode> {
// 1. Register the worklet module (once per context)
// 2. Load the WASM binary
// 3. Create and return the RnnoiseWorkletNode
}
Dynamic Toggle Behavior
When the user toggles noise suppression while in a voice call:
Currently: saves the preference, but requires rejoining to take effect (since constraints are set at getUserMedia time)
New behavior: updateRnnoiseEnabled() dynamically rewires the audio graph without restarting the mic stream. This is possible because RNNoise runs as an AudioWorkletNode in the processing chain, not as a getUserMedia constraint.
Error Handling
If WASM fails to load (e.g., old browser, CSP blocking), log a warning and fall back to the direct source → gain → destination chain
If AudioWorklet is not supported, fall back to browser-native noise suppression
Sample Rate
RNNoise expects 48kHz audio. AudioContext defaults to the system sample rate. The @sapphi-red/web-noise-suppressor package handles internal resampling if needed, but since Opus also operates at 48kHz this should align naturally.
Verification
cd client && npm install — verify the dependency installs
npm run build — verify Vite builds successfully with the WASM/worklet assets
npm run typecheck — verify no TypeScript errors
Manual test: join a voice channel, enable noise suppression, verify:
RNNoise node appears in the audio processing chain (check console logs)
Background noise (fan, keyboard) is significantly reduced
Voice quality remains clear
Toggling the setting on/off dynamically changes suppression without dropping the call
Test in both web browser and Tauri desktop client
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /home/guibibi/.REDACTED.jsonl
(new)
createRnnoiseNode(ctx) — loads WASM (cached after first load), registers worklet (cached per AudioContext), returns RnnoiseWorkletNode | null
destroyRnnoiseNode(node) — disconnects and calls node.destroy()
MicrophoneProcessingSession extended with sourceNode, destinationNode, rnnoiseNode
createProcessedMicrophoneTrack made async, takes noiseSuppression param, wires chain with or without RNNoise node
disposeMicrophoneProcessing / disposePendingMicrophoneProcessing now clean up the RNNoise node
New updateRnnoiseEnabled(enabled) export — dynamically rewires the audio graph without restarting the mic
client/src/api/media/constraints.ts — noiseSuppression is now always false (RNNoise handles it via the worklet)
client/src/api/media/producers.ts + devices.ts — Updated to await createProcessedMicrophoneTrack(...) with the new voiceNoiseSuppressionEnabled() argument
client/src/components/SettingsPage.tsx — handleVoiceNoiseSuppressionToggle now calls updateRnnoiseEnabled(enabled) (dynamic, no mic restart needed)
client/src/components/settings/VoiceAudioPreferences.tsx — Description updated to "AI-powered noise suppression that reduces background sounds including keyboard clicks and ambient noise."