Skip to content

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

fix: prevent blank audio from pasting

Gabriel Stein5bcd750273bc
diff --git a/src/helpers/whisper.js b/src/helpers/whisper.js
index a4b8357ea..de4b5b8e4 100644
--- a/src/helpers/whisper.js
+++ b/src/helpers/whisper.js
@@ -768,7 +768,7 @@ class WhisperManager {
} catch (parseError) {
// Try parsing as plain text (non-JSON output)
const text = output.trim();
- if (text) {
+ if (text && !this.isBlankAudioMarker(text)) {
return { success: true, text };
}
throw new Error(`Failed to parse Whisper output: ${parseError.message}`);
@@ -786,7 +786,7 @@ class WhisperManager {
.map((seg) => seg.text)
.join("")
.trim();
- if (!text) {
+ if (!text || this.isBlankAudioMarker(text)) {
return { success: false, message: "No audio detected" };
}
return { success: true, text };
@@ -795,7 +795,7 @@ class WhisperManager {
// Handle whisper-server format (has "text" field directly)
if (result.text !== undefined) {
const text = typeof result.text === "string" ? result.text.trim() : "";
- if (!text) {
+ if (!text || this.isBlankAudioMarker(text)) {
return { success: false, message: "No audio detected" };
}
return { success: true, text };
@@ -804,6 +804,13 @@ class WhisperManager {
return { success: false, message: "No audio detected" };
}
+ // Check if text is a whisper.cpp blank audio marker
+ isBlankAudioMarker(text) {
+ // whisper.cpp outputs "[BLANK_AUDIO]" when there's silence or insufficient audio
+ const normalized = text.trim().toLowerCase();
+ return normalized === "[blank_audio]" || normalized === "[ blank_audio ]";
+ }
+
async cleanupTempFile(tempAudioPath) {
try {
await fsPromises.unlink(tempAudioPath);