From ae0378cee48177ffc12000113047f0ef53727dd0 Mon Sep 17 00:00:00 2001 From: wiiiii123 Date: Wed, 6 May 2026 19:10:22 +0700 Subject: [PATCH] fix(recording): declip native Windows mic peaks --- electron/ipc/ffmpeg/filters.test.ts | 4 ++-- electron/ipc/recording/windows.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/electron/ipc/ffmpeg/filters.test.ts b/electron/ipc/ffmpeg/filters.test.ts index 9660fd29..8b8ecfdb 100644 --- a/electron/ipc/ffmpeg/filters.test.ts +++ b/electron/ipc/ffmpeg/filters.test.ts @@ -116,11 +116,11 @@ describe("getAudioSyncAdjustment", () => { it("can prepend mic normalization filters before sync handling", () => { const filterParts: string[] = []; appendSyncedAudioFilter(filterParts, "[1:a]", "aout", getAudioSyncAdjustment(120, 120), { - preFilters: ["loudnorm=I=-16:TP=-1.5:LRA=11"], + preFilters: ["adeclip=threshold=1", "loudnorm=I=-16:TP=-1.5:LRA=11"], }); expect(filterParts).toEqual([ - "[1:a]loudnorm=I=-16:TP=-1.5:LRA=11,aresample=async=1:first_pts=0,asetpts=PTS-STARTPTS[aout]", + "[1:a]adeclip=threshold=1,loudnorm=I=-16:TP=-1.5:LRA=11,aresample=async=1:first_pts=0,asetpts=PTS-STARTPTS[aout]", ]); }); }); diff --git a/electron/ipc/recording/windows.ts b/electron/ipc/recording/windows.ts index 9c944028..63d4e24f 100644 --- a/electron/ipc/recording/windows.ts +++ b/electron/ipc/recording/windows.ts @@ -32,9 +32,9 @@ import { import { emitRecordingInterrupted } from "./events"; const execFileAsync = promisify(execFile); -// Match the browser path's "usable speech level" intent with a standard -// loudness pass on native Windows mic audio instead of a fixed tiny boost. -const WINDOWS_NATIVE_MIC_PRE_FILTERS = ["loudnorm=I=-16:TP=-1.5:LRA=11"]; +// Repair rare clipped mic peaks before loudness normalization so headset/driver +// overloads do not get amplified into audible pops during mux/export. +const WINDOWS_NATIVE_MIC_PRE_FILTERS = ["adeclip=threshold=1", "loudnorm=I=-16:TP=-1.5:LRA=11"]; const MIN_NATIVE_WINDOWS_VIDEO_PAD_MS = 500; export async function isNativeWindowsCaptureAvailable(): Promise {