Skip to content

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

fix(dictation): Make VAD opt-in and rescue dictionary-echo decodes

Chadpiha2b6aab3d684c
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index efef900cc..53c5b7d79 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -1416,7 +1416,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
);
const transcriptionStart = performance.now();
- const result = await window.electronAPI.transcribeLocalWhisper(arrayBuffer, options);
+ let result = await window.electronAPI.transcribeLocalWhisper(arrayBuffer, options);
timings.transcriptionProcessingDurationMs = Math.round(
performance.now() - transcriptionStart
);
@@ -1432,7 +1432,24 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
if (result.success && result.text) {
if (this.isDictionaryEcho(result.text)) {
- throw new Error("No audio detected");
+ // Whisper decoded (near-)silence and continued the dictionary prompt —
+ // typically VAD stripping pause-heavy speech (#1454). Retry once
+ // without the prompt and without VAD: real speech comes back as the
+ // true transcript, true silence comes back empty.
+ const retry = await window.electronAPI.transcribeLocalWhisper(arrayBuffer, {
+ model: options.model,
+ ...(options.language ? { language: options.language } : {}),
+ skipVad: true,
+ });
+ if (!retry?.success || !retry.text?.trim() || this.isDictionaryEcho(retry.text)) {
+ throw new Error("No audio detected");
+ }
+ logger.info(
+ "Recovered transcript after dictionary-echo detection",
+ { retryTextLength: retry.text.length },
+ "audio"
+ );
+ result = retry;
}
const rawText = result.text;
const reasoningStart = performance.now();
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 3ac551e74..3cb3bc7c3 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -521,7 +521,7 @@ class IPCHandlers {
this.speakerDiarizationEnabled = true;
this.activeMeetingSpeakerConfig = null;
this.whisperVadSettings = {
- dictationSileroEnabled: true,
+ dictationSileroEnabled: false,
noteRecordingSileroEnabled: true,
meetingSileroEnabled: true,
...DEFAULT_WHISPER_VAD_CONFIG,
@@ -552,7 +552,7 @@ class IPCHandlers {
_getWhisperVadSettings() {
const current = this.whisperVadSettings || {};
return {
- dictationSileroEnabled: current.dictationSileroEnabled !== false,
+ dictationSileroEnabled: current.dictationSileroEnabled === true,
noteRecordingSileroEnabled: current.noteRecordingSileroEnabled !== false,
meetingSileroEnabled: current.meetingSileroEnabled !== false,
...sanitizeWhisperVadConfig(current),
@@ -2310,9 +2310,14 @@ class IPCHandlers {
});
try {
- const vadOptions = this._resolveWhisperVadOptions("dictation");
+ // skipVad: dictionary-echo rescue retries decode VAD-free, since VAD
+ // stripping the speech is what turned the transcript into prompt echo.
+ const { skipVad, ...requestOptions } = options;
+ const vadOptions = skipVad
+ ? { vadEnabled: false }
+ : this._resolveWhisperVadOptions("dictation");
const result = await this.whisperManager.transcribeLocalWhisper(audioBlob, {
- ...options,
+ ...requestOptions,
...vadOptions,
});
diff --git a/src/helpers/whisperVadConfig.js b/src/helpers/whisperVadConfig.js
index c3eaee5b6..bded6980f 100644
--- a/src/helpers/whisperVadConfig.js
+++ b/src/helpers/whisperVadConfig.js
@@ -22,9 +22,14 @@ function sanitizeWhisperVadConfig(input = {}) {
}
function resolveContextSileroEnabled(settings = {}, context = "dictation") {
- if (context === "dictation") return settings.dictationSileroEnabled !== false;
- if (context === "noteRecording") return settings.noteRecordingSileroEnabled !== false;
- if (context === "meeting") return settings.meetingSileroEnabled !== false;
+ const resolved = settings || {};
+ // Dictation is opt-in: VAD on pause-heavy dictations can strip the speech and
+ // leave Whisper decoding near-silence seeded with the dictionary prompt, which
+ // replaces the transcript with dictionary words (#1454). Long-form contexts
+ // (notes, meetings) keep VAD to skip extended silence.
+ if (context === "dictation") return resolved.dictationSileroEnabled === true;
+ if (context === "noteRecording") return resolved.noteRecordingSileroEnabled !== false;
+ if (context === "meeting") return resolved.meetingSileroEnabled !== false;
return true;
}
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index beb2f36d1..cf56b3280 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -1069,7 +1069,9 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
appleCalendarConnected: readBoolean("appleCalendarConnected", false),
meetingProcessDetection: readBoolean("meetingProcessDetection", true),
speakerDiarizationEnabled: readBoolean("speakerDiarizationEnabled", true),
- dictationSileroEnabled: readBoolean("dictationSileroEnabled", true),
+ // Off by default: VAD on pause-heavy dictations can strip the speech and make
+ // Whisper hallucinate the dictionary prompt as the transcript (#1454).
+ dictationSileroEnabled: readBoolean("dictationSileroEnabled", false),
noteRecordingSileroEnabled: readBoolean("noteRecordingSileroEnabled", true),
meetingSileroEnabled: readBoolean("meetingSileroEnabled", true),
whisperVadThreshold: clampVadValue("threshold", readString("whisperVadThreshold", "0.5")),
diff --git a/test/helpers/whisperVadConfig.test.js b/test/helpers/whisperVadConfig.test.js
index 1bd2094ad..f3fa5f225 100644
--- a/test/helpers/whisperVadConfig.test.js
+++ b/test/helpers/whisperVadConfig.test.js
@@ -24,13 +24,26 @@ test("sanitizeWhisperVadConfig applies defaults and clamps invalid values", asyn
});
});
-test("resolveContextSileroEnabled prefers context value then falls back to true", async () => {
+test("resolveContextSileroEnabled prefers context value then falls back to per-context default", async () => {
const { resolveContextSileroEnabled } = await import("../../src/helpers/whisperVadConfig.js");
assert.equal(resolveContextSileroEnabled({ dictationSileroEnabled: false }, "dictation"), false);
+ assert.equal(resolveContextSileroEnabled({ dictationSileroEnabled: true }, "dictation"), true);
assert.equal(
resolveContextSileroEnabled({ noteRecordingSileroEnabled: true }, "noteRecording"),
true
);
assert.equal(resolveContextSileroEnabled({}, "meeting"), true);
});
+
+// VAD on pause-heavy dictations can strip the speech, making Whisper decode
+// near-silence seeded with the custom-dictionary prompt — the transcript is
+// replaced by dictionary words (#1454). Dictation VAD is opt-in.
+test("resolveContextSileroEnabled defaults dictation off, other contexts on", async () => {
+ const { resolveContextSileroEnabled } = await import("../../src/helpers/whisperVadConfig.js");
+
+ assert.equal(resolveContextSileroEnabled({}, "dictation"), false);
+ assert.equal(resolveContextSileroEnabled(undefined, "dictation"), false);
+ assert.equal(resolveContextSileroEnabled({}, "noteRecording"), true);
+ assert.equal(resolveContextSileroEnabled({}, "meeting"), true);
+});