Denoise worklet node ignores its channelCount: 1 (no channelCountMode: "explicit") #24

Closed
opened 2026-09-12 02:13:10 -04:00 by jared · 0 comments
Owner

Severity: low · Type: bug · Confidence: medium

Location: src/lotus/lotusDenoiseProcessor.ts:376-381

Problem

new AudioWorkletNode(ctx, name, { channelCount: 1, ... }) leaves channelCountMode at its default "max", under which channelCount is ignored and the node's computed input channel count follows the upstream node. If getUserMedia returns a stereo mic (EC's audioCaptureDefaults do not pin channelCount), the worklet receives 2 channels while its processorOptions.maxChannels is 1, so the second channel is dropped or left unprocessed depending on the sapphi worklet's behaviour. The same mismatch applies to the dry path (source.connect(dryGain) at line 309), where the raw stereo signal is summed with a mono wet signal at the destination.

How to trigger

Use a stereo-capable input device (many USB interfaces and virtual cables) with lotusModel=rnnoise.

Suggested fix

Set channelCountMode: "explicit" and channelInterpretation: "speakers" on the worklet node (and on the gains), or downmix explicitly with a ChannelMergerNode/GainNode before the worklet.


Filed from the September 2026 audit (branch lotus).

**Severity:** low · **Type:** bug · **Confidence:** medium **Location:** `src/lotus/lotusDenoiseProcessor.ts:376-381` ### Problem `new AudioWorkletNode(ctx, name, { channelCount: 1, ... })` leaves `channelCountMode` at its default `"max"`, under which `channelCount` is ignored and the node's computed input channel count follows the upstream node. If `getUserMedia` returns a stereo mic (EC's `audioCaptureDefaults` do not pin `channelCount`), the worklet receives 2 channels while its `processorOptions.maxChannels` is `1`, so the second channel is dropped or left unprocessed depending on the sapphi worklet's behaviour. The same mismatch applies to the dry path (`source.connect(dryGain)` at line 309), where the raw stereo signal is summed with a mono wet signal at the destination. ### How to trigger Use a stereo-capable input device (many USB interfaces and virtual cables) with `lotusModel=rnnoise`. ### Suggested fix Set `channelCountMode: "explicit"` and `channelInterpretation: "speakers"` on the worklet node (and on the gains), or downmix explicitly with a `ChannelMergerNode`/`GainNode` before the worklet. --- _Filed from the September 2026 audit (branch `lotus`)._
jared added this to the EC fork audit 2026-09 · Medium & Low milestone 2026-09-12 02:13:10 -04:00
jared added the bugpriority: lowarea: denoise labels 2026-09-12 02:13:10 -04:00
jared self-assigned this 2026-09-12 02:13:10 -04:00
jared closed this issue 2026-09-13 01:22:45 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/element-call#24