Voice Input into Any Windows Window in a Second: Offline, on CPU, Without a Single Gigabyte of Torch
OpenAI
The article describes WhisperType, an open-source tool for offline voice dictation in Windows, based on faster-whisper and running on CPU. It explains key optimizations: variable encoder window, turning off timestamps, stream recognition, and auto thread selection. As a result, the response time reduces from ~4 seconds to ~1 second for short phrases.
The author developed WhisperType, a free and open-source (MIT) dictation tool for Windows 10/11 x64. It allows voice input into any window via hotkey, works offline without admin rights, and uses a local model deepdml/faster-whisper-large-v3-turbo-ct2 (CTranslate2, int8_float32). The main problem is that the Whisper encoder always processes a fixed 30-second window, so even a short phrase takes about 4 seconds on CPU. The solution is to monkeypatch the pad_or_trim function to narrow the encoder window according to the real speech length. Also, timestamps are disabled when the window is narrowed, and a text-based method for removing rare repetitions is used. For long dictations, stream recognition is implemented: audio is cut at pauses and processed in chunks while recording continues. The optimal number of threads is auto-selected as all logical processors minus two. Additional optimizations: explicit language detection, always-open audio stream, pre-warmed model, deferred imports, and checks for silence and audio device failures. The system-level code uses only ctypes and WinAPI, avoiding hooks libraries.
- Abbreviations
- MIT = Massachusetts Institute of Technology — лицензия MIT
- CPU = Central Processing Unit — центральный процессор
- IDE = Integrated Development Environment — среда разработки
- GC = Garbage Collector — сборщик мусора
- SID = Security Identifier — идентификатор безопасности
- SMT = Simultaneous Multithreading — одновременная многопоточность
- UIPI = User Interface Privilege Isolation — изоляция привилегий пользовательского интерфейса
- USB = Universal Serial Bus — USB
- VAD = Voice Activity Detection — детектор голосовой активности
- WinAPI = Windows Application Programming Interface — API Windows
Source: Habr — хаб ML —
original
