Fix #219: Suppress [BLANK_AUDIO] tokens in whisper.cpp output (#222)

- Add suppress_blank=True and suppress_non_speech_tokens=True parameters
  to whisper.cpp Model initialization to prevent blank audio tokens
  from being output when transcribing silent audio
- This implements Option 2 from the investigation: suppress at the
  whisper.cpp level rather than post-processing filtering
- Root cause: whisper.cpp outputs a special [BLANK_AUDIO] token
  when transcribing silent audio, which was being inserted into the
  text field when users paused with the mic on
This commit is contained in:
Jatin K Malik
2026-02-17 17:20:36 -08:00
committed by GitHub
parent b4e59b453d
commit d3f67642c2
@@ -633,7 +633,12 @@ class SpeechRecognitionManager:
cpu_count = multiprocessing.cpu_count()
load_start_time = time.time()
self.model = Model(model_path, n_threads=n_threads)
self.model = Model(
model_path,
n_threads=n_threads,
suppress_blank=True,
suppress_non_speech_tokens=True,
)
load_duration = time.time() - load_start_time
logger.info(