(feat): improved microphone gate
All checks were successful
/ build-web (push) Successful in 1m16s
/ build-desktop (push) Successful in 14m2s
/ build-mobile (push) Successful in 19m13s
/ release (push) Successful in 24s

(fix): weird behaviour related to users that are screensharing
This commit is contained in:
Alois 2026-05-15 16:19:03 +02:00
commit c795f691bf
5 changed files with 34 additions and 9 deletions

View file

@ -1,7 +1,8 @@
import { log } from "@tensamin/shared/log";
import { useCall } from "./store";
const SPEAKING_THRESHOLD = 0.01;
const SPEAKING_HANGTIME_MS = 250;
const SPEAKING_HANGTIME_MS = 500;
const ANALYSIS_INTERVAL_MS = 30;
const FFT_SIZE = 256;
@ -137,8 +138,10 @@ class SpeakingDetector {
const db = 20 * Math.log10(Math.max(rms, 0.0001));
if (!this.localMicGateClosed && db < this.gateThresholdStart) {
log(3, "noise gate", "purple", "closed");
this.muteLocalTrack(true);
} else if (this.localMicGateClosed && db > this.gateThresholdEnd) {
log(3, "noise gate", "purple", "opened");
this.muteLocalTrack(false);
}
}