Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

Add an echo-cancellation toggle for meeting recording (#1135)

Stanislav Ochotnickýb6442f854f5b
diff --git a/CLAUDE.md b/CLAUDE.md
index e392723e5..8294268b1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -757,6 +757,7 @@ When "Share screen context" is enabled (Settings → AI Models → Voice Assista
Live meeting transcription runs two streams (mic + system-audio tap) and must keep the remote party's voice, as heard through the local speakers, out of the mic transcript. The policy lives in pure, unit-tested seams so it can be tuned without touching the IPC plumbing:
- **Audio layer**: `meetingEchoLeakDetector.js` correlates mic chunks against recent system audio; `meetingMicGate.js` turns chunk RMS/peak (+ a "system speaking" lookback) into a `send` / `zero` / `skip` verdict that `ipcHandlers.js` applies in `dispatchMeetingAudioBuffer` (streaming) and `transcribeLocalMeetingChunk` (local)
+- **Echo cancellation**: the WebRTC AEC3 helper (`meetingAecManager.js`, `native/meeting-aec-helper/`) replaces the mic channel only when Settings → Speech-to-Text → Note Recording → Echo cancellation for meetings is on (`meetingAecEnabled`, default off, sent as the `aecEnabled` start option). With headphones there is no echo, and AEC3 still cuts the user's own speech, worst in the first seconds (#1025)
- **Text layer**: `meetingMicHoldback.js` decides whether a mic final is risky (held back), a duplicate of recent system text (dropped), or racing an arriving system final (retracted); the `ipcHandlers.js` adapters (`shouldSkipDuplicateMicSegment`, `hasRiskyMicDuplicateProfile`, `removeRacingMicEntriesFor`, `removePendingMicFinalsFor`) apply the results to closure state and emit `meeting-transcription-segment` events (`partial` / `final` / `retract`)
- **Renderer**: `src/stores/meetingSegmentReducer.ts` is the pure `(state, event, deps) → reduction` transition for those events (timestamp-sorted insert, retract by exact match, per-source partial slots); `meetingRecordingStore.ts` supplies `mintSegmentId` / `decorateFinal` (speaker identifications, provisional speaker, locks — must not write to the store) and applies the reduction. Tests: `test/stores/meetingSegmentReducer.test.js`, `test/stores/meetingRecordingStoreImports.test.js`
- **Regression pins**: BYOK `session.update` payload and the disconnect-commit callback (`test/helpers/openaiRealtimeStreaming.test.js`, `tinfoilRealtimeStreaming.test.js`), token-endpoint wire bodies (`test/helpers/realtimeTokenProviders.test.js`). Tests named `characterization: …` pin known oddities on purpose — flip them deliberately when changing policy
diff --git a/src/components/settings/MeetingSettings.tsx b/src/components/settings/MeetingSettings.tsx
index c15a5dea8..0acbc4c14 100644
--- a/src/components/settings/MeetingSettings.tsx
+++ b/src/components/settings/MeetingSettings.tsx
@@ -31,6 +31,21 @@ export function MeetingSpeakerDetectionRow() {
);
}
+function MeetingEchoCancellationRow() {
+ const { t } = useTranslation();
+ const meetingAecEnabled = useSettingsStore((s) => s.meetingAecEnabled);
+ const setMeetingAecEnabled = useSettingsStore((s) => s.setMeetingAecEnabled);
+
+ return (
+ <SettingsRow
+ label={t("settingsPage.transcription.aec.toggle.title")}
+ description={t("settingsPage.transcription.aec.toggle.description")}
+ >
+ <Toggle checked={meetingAecEnabled} onChange={setMeetingAecEnabled} />
+ </SettingsRow>
+ );
+}
+
const noop = () => {};
export function MeetingTranscriptionPanel() {
@@ -179,6 +194,7 @@ export function MeetingTranscriptionPanel() {
{effectiveTranscriptionMode === "providers" && renderTranscriptionPicker("cloud")}
{effectiveTranscriptionMode === "local" && renderTranscriptionPicker("local")}
<MeetingSpeakerDetectionRow />
+ <MeetingEchoCancellationRow />
</div>
);
}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 4ee3fe753..d770661f3 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -7742,6 +7742,9 @@ class IPCHandlers {
const startMeetingAec = async (systemAudioMode) => {
meetingAecEnabled = false;
+ if (meetingConnectionOptions.aecEnabled !== true) {
+ return false;
+ }
if (systemAudioMode === "unsupported" || !this.meetingAecManager?.isAvailable()) {
return false;
}
diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json
index 09eddf37a..34987be0e 100644
--- a/src/locales/ar/translation.json
+++ b/src/locales/ar/translation.json
@@ -3926,6 +3926,12 @@
},
"transcriptionPreview": "معاينة التفريغ المباشر",
"transcriptionPreviewDescription": "إظهار التفريغ في نافذة عائمة قبل التنقيح",
+ "aec": {
+ "toggle": {
+ "title": "إلغاء الصدى في الاجتماعات",
+ "description": "يلغي صوت الاجتماع الذي يتسرب إلى الميكروفون. اتركه متوقفًا عند استخدام سماعات الرأس أو سماعات الأذن، إذ لا يوجد صدى لإلغائه وقد يكتم صوتك تمامًا."
+ }
+ },
"vad": {
"title": "اكتشاف النشاط الصوتي",
"description": "تكوين كيفية اكتشاف Silero VAD للكلام وتقسيمه عند التفريغ المحلي باستخدام Whisper",
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 2da5a0510..ecb0f42c8 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -2567,6 +2567,12 @@
},
"transcriptionPreview": "Live-Transkriptionsvorschau",
"transcriptionPreviewDescription": "Transkription vor der Bereinigung in einem Fenster anzeigen",
+ "aec": {
+ "toggle": {
+ "title": "Echounterdrückung für Meetings",
+ "description": "Unterdrückt Meeting-Audio, das in Ihr Mikrofon gelangt. Lassen Sie dies bei Verwendung von Kopfhörern oder Ohrhörern deaktiviert – es gibt kein Echo zu unterdrücken und es kann Ihre Stimme vollständig unterdrücken."
+ }
+ },
"vad": {
"title": "Sprachaktivitätserkennung",
"description": "Konfiguriere, wie Silero VAD Sprache für die lokale Whisper-Transkription erkennt und segmentiert",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index a82b5130b..f3a65ae63 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -2567,6 +2567,12 @@
},
"transcriptionPreview": "Live Transcription Preview",
"transcriptionPreviewDescription": "Show transcription in a floating window before cleanup",
+ "aec": {
+ "toggle": {
+ "title": "Echo cancellation for meetings",
+ "description": "Cancel meeting audio that leaks into your microphone. Leave this off when using headphones or earphones — there is no echo to cancel and it can suppress your voice entirely."
+ }
+ },
"vad": {
"title": "Voice Activity Detection",
"description": "Configure how Silero VAD detects and segments speech for local Whisper transcription",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index e83989eb0..5fc8a0ce2 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -2325,6 +2325,12 @@
},
"transcriptionPreview": "Vista previa en vivo",
"transcriptionPreviewDescription": "Mostrar transcripción en una ventana flotante antes de la corrección",
+ "aec": {
+ "toggle": {
+ "title": "Cancelación de eco para reuniones",
+ "description": "Cancela el audio de la reunión que se filtra en tu micrófono. Déjalo desactivado cuando uses auriculares o audífonos: no hay eco que cancelar y puede suprimir tu voz por completo."
+ }
+ },
"vad": {
"title": "Detección de actividad de voz",
"description": "Configura cómo Silero VAD detecta y segmenta el habla para la transcripción local con Whisper",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 1f92a5825..36c7e89c2 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -2567,6 +2567,12 @@
},
"transcriptionPreview": "Aperçu en direct",
"transcriptionPreviewDescription": "Afficher la transcription dans une fenêtre flottante avant correction",
+ "aec": {
+ "toggle": {
+ "title": "Annulation d'écho pour les réunions",
+ "description": "Annule l'audio de la réunion qui s'infiltre dans votre microphone. Laissez cette option désactivée lorsque vous utilisez un casque ou des écouteurs — il n'y a aucun écho à annuler et cela peut supprimer entièrement votre voix."
+ }
+ },
"vad": {
"title": "Détection d'activité vocale",
"description": "Configurez la manière dont Silero VAD détecte et segmente la parole pour la transcription locale Whisper",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 6f165e170..1a70ef3bb 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -2272,6 +2272,12 @@
},
"transcriptionPreview": "Anteprima dal vivo",
"transcriptionPreviewDescription": "Mostra la trascrizione in una finestra flottante prima della correzione",
+ "aec": {
+ "toggle": {
+ "title": "Cancellazione dell'eco per le riunioni",
+ "description": "Cancella l'audio della riunione che si infiltra nel microfono. Lascia questa opzione disattivata quando usi cuffie o auricolari: non c'è alcun eco da cancellare e potrebbe sopprimere completamente la tua voce."
+ }
+ },
"vad": {
"title": "Rilevamento attività vocale",
"description": "Configura come Silero VAD rileva e segmenta il parlato per la trascrizione locale Whisper",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 31b1fe0a5..99445054b 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -2272,6 +2272,12 @@
},
"transcriptionPreview": "リアルタイム文字起こしプレビュー",
"transcriptionPreviewDescription": "クリーンアップ前にフローティングウィンドウで文字起こしを表示",
+ "aec": {
+ "toggle": {
+ "title": "会議のエコーキャンセル",
+ "description": "マイクに漏れ込む会議の音声をキャンセルします。ヘッドフォンやイヤフォンを使用しているときはオフのままにしてください。キャンセルすべきエコーがなく、あなたの声を完全に抑制してしまう可能性があります。"
+ }
+ },
"vad": {
"title": "音声アクティビティ検出",
"description": "ローカル Whisper 文字起こしで Silero VAD が発話を検出・分割する方法を設定します",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index f6fc8bee8..80d8d5822 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -2251,6 +2251,12 @@
},
"transcriptionPreview": "Pré-visualização ao vivo",
"transcriptionPreviewDescription": "Mostrar transcrição em janela flutuante antes da limpeza",
+ "aec": {
+ "toggle": {
+ "title": "Cancelamento de eco para reuniões",
+ "description": "Cancela o áudio da reunião que vaza para o seu microfone. Deixe isto desativado ao usar fones de ouvido ou auriculares — não há eco para cancelar e pode suprimir totalmente a sua voz."
+ }
+ },
"vad": {
"title": "Detecção de atividade de voz",
"description": "Configure como o Silero VAD detecta e segmenta a fala na transcrição local do Whisper",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 310d2ea1d..3e8f47981 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -2278,6 +2278,12 @@
},
"transcriptionPreview": "Предпросмотр транскрипции",
"transcriptionPreviewDescription": "Показывать транскрипцию в плавающем окне перед очисткой",
+ "aec": {
+ "toggle": {
+ "title": "Подавление эха для встреч",
+ "description": "Подавляет звук встречи, попадающий в ваш микрофон. Оставьте этот параметр выключенным при использовании наушников или гарнитуры — эха для подавления нет, и это может полностью заглушить ваш голос."
+ }
+ },
"vad": {
"title": "Определение голосовой активности",
"description": "Настройте, как Silero VAD обнаруживает и сегментирует речь для локальной транскрипции Whisper",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index a7a2390cf..279f37dde 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -2272,6 +2272,12 @@
},
"transcriptionPreview": "实时转录预览",
"transcriptionPreviewDescription": "在浮动窗口中显示转录结果,然后再进行文本整理",
+ "aec": {
+ "toggle": {
+ "title": "会议回声消除",
+ "description": "消除泄漏到麦克风中的会议音频。使用耳机或耳塞时请关闭此功能——没有需要消除的回声,而且它可能会完全抑制您的声音。"
+ }
+ },
"vad": {
"title": "语音活动检测",
"description": "配置 Silero VAD 如何为本地 Whisper 转录检测并切分语音",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index da601d41d..89d3acac5 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -2272,6 +2272,12 @@
},
"transcriptionPreview": "即時轉錄預覽",
"transcriptionPreviewDescription": "在浮動視窗中顯示轉錄結果,再進行文字整理",
+ "aec": {
+ "toggle": {
+ "title": "會議回音消除",
+ "description": "消除洩漏到麥克風中的會議音訊。使用耳機或耳塞時請關閉此功能——沒有需要消除的回音,且它可能會完全抑制您的聲音。"
+ }
+ },
"vad": {
"title": "語音活動偵測",
"description": "設定 Silero VAD 如何為本機 Whisper 轉錄偵測並切分語音",
diff --git a/src/stores/meetingRecordingStore.ts b/src/stores/meetingRecordingStore.ts
index fb72a013d..9997acd1a 100644
--- a/src/stores/meetingRecordingStore.ts
+++ b/src/stores/meetingRecordingStore.ts
@@ -942,6 +942,7 @@ export async function startRecording(args: StartRecordingArgs): Promise<boolean>
noteId: args.noteId ?? null,
sessionId,
autoEndEligible: args.autoEndEligible,
+ aecEnabled: getSettings().meetingAecEnabled,
});
const micCapturePromise = getMeetingMicConstraints().then(async (constraints) => {
if (!isCurrentStart()) return null;
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 56e73cf4f..d592f32b1 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -292,6 +292,7 @@ const BOOLEAN_SETTINGS = new Set([
"dictationSileroEnabled",
"noteRecordingSileroEnabled",
"meetingSileroEnabled",
+ "meetingAecEnabled",
"isSignedIn",
"autoPasteEnabled",
"keepTranscriptionInClipboard",
@@ -906,6 +907,7 @@ export interface SettingsState
dictationSileroEnabled: boolean;
noteRecordingSileroEnabled: boolean;
meetingSileroEnabled: boolean;
+ meetingAecEnabled: boolean;
whisperVadThreshold: number;
whisperVadMinSpeechDurationMs: number;
whisperVadMinSilenceDurationMs: number;
@@ -1221,6 +1223,7 @@ export interface SettingsState
setDictationSileroEnabled: (value: boolean) => void;
setNoteRecordingSileroEnabled: (value: boolean) => void;
setMeetingSileroEnabled: (value: boolean) => void;
+ setMeetingAecEnabled: (value: boolean) => void;
setWhisperVadThreshold: (value: number) => void;
setWhisperVadMinSpeechDurationMs: (value: number) => void;
setWhisperVadMinSilenceDurationMs: (value: number) => void;
@@ -1669,6 +1672,9 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
dictationSileroEnabled: readBoolean("dictationSileroEnabled", false),
noteRecordingSileroEnabled: readBoolean("noteRecordingSileroEnabled", true),
meetingSileroEnabled: readBoolean("meetingSileroEnabled", true),
+ // Acoustic echo cancellation for meetings is opt-in: on headsets there's no
+ // echo to cancel and it can suppress the mic entirely. See ipcHandlers AEC gate.
+ meetingAecEnabled: readBoolean("meetingAecEnabled", false),
whisperVadThreshold: clampVadValue("threshold", readString("whisperVadThreshold", "0.5")),
whisperVadMinSpeechDurationMs: clampVadValue(
"minSpeechDurationMs",
@@ -2480,6 +2486,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
window.electronAPI?.setWhisperVadConfig?.({ meetingSileroEnabled: value });
}
},
+ setMeetingAecEnabled: createBooleanSetter("meetingAecEnabled"),
setWhisperVadThreshold: (value: number) => {
const next = clampVadValue("threshold", value);
if (isBrowser) localStorage.setItem("whisperVadThreshold", String(next));
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 42565b0d3..68524f713 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -3048,6 +3048,7 @@ declare global {
noteId?: number | null;
sessionId: string;
autoEndEligible: boolean;
+ aecEnabled?: boolean;
}) => Promise<
{
success: boolean;
diff --git a/test/helpers/meetingEchoCancellationGate.test.js b/test/helpers/meetingEchoCancellationGate.test.js
new file mode 100644
index 000000000..dae98db07
--- /dev/null
+++ b/test/helpers/meetingEchoCancellationGate.test.js
@@ -0,0 +1,42 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const fs = require("node:fs");
+const path = require("node:path");
+const vm = require("node:vm");
+
+// Execute the real startMeetingAec closure with only the helper process replaced.
+const source = fs.readFileSync(path.join(__dirname, "../../src/helpers/ipcHandlers.js"), "utf8");
+const startMeetingAecSource = source.slice(
+ source.indexOf("const startMeetingAec ="),
+ source.indexOf("const flushPendingMeetingMicChunks =")
+);
+
+async function startMeetingAec(meetingConnectionOptions) {
+ let helperStarts = 0;
+ const context = {
+ meetingAecEnabled: false,
+ meetingConnectionOptions,
+ meetingAecManager: {
+ isAvailable: () => true,
+ start: async () => {
+ helperStarts += 1;
+ return true;
+ },
+ },
+ debugLogger: { info() {}, warn() {}, debug() {} },
+ };
+ vm.createContext(context);
+ vm.runInContext(`${startMeetingAecSource}; globalThis.run = startMeetingAec;`, context);
+ const started = await context.run("loopback");
+ return { started, helperStarts };
+}
+
+test("the AEC helper stays off unless the meeting asked for echo cancellation", async () => {
+ for (const options of [{}, { aecEnabled: false }]) {
+ assert.deepEqual(await startMeetingAec(options), { started: false, helperStarts: 0 });
+ }
+});
+
+test("the AEC helper starts when the meeting asked for echo cancellation", async () => {
+ assert.deepEqual(await startMeetingAec({ aecEnabled: true }), { started: true, helperStarts: 1 });
+});