Speech to text with Whisper-cpp Emacs and whisper.el

Speech to text with Whisper-cpp built with Vulkan support to use the GPU
and Emacs with Sacha Chua's fork of the whisper.el package with additional features


The Emacs whisper.el package and whisper.cpp work on Linux, Mac, Windows and Freebsd

Using a keyboard shortcut in Emacs you can start recording with your microphone, and then press the same keyboard when you have finished to insert the transcribed text into the buffer.

In this video i cover how to use you own build of Whisper-cpp with Vulkan support to use the GPU, how to specify a model to use and on Freebsd use oss audio and specify the microphone.

Emacs code for whisper.el

Make sure to change /dev/dsp3 to your audio device

init.el

Code:
;; ----------------------------------------------------------------------------------
;; whisper-cpp
;; ----------------------------------------------------------------------------------

(use-package whisper
  ;; Leverage the built-in package-vc features to clone the exact fork branch
  :vc (:url "https://github.com/sachac/whisper.el"
       :branch "whisper-insert-text-at-point-function")
  :ensure t
  :bind ("C-c w" . whisper-run)
  :config
  (setq whisper-install-whispercpp nil)
  (setq whisper-model "small")
  (setq whisper-language "en")
  (setq whisper-return-cursor-to-start nil)
  ;; Explicitly tell ffmpeg to use the Open Sound System driver for FreeBSD
  (setq whisper--ffmpeg-input-format "oss")
  ;; Point to your primary system microphone device (usually /dev/dsp)
  (setq whisper--ffmpeg-input-device "/dev/dsp3")

  (defun whisper-command (file)
      (list "whisper-cli"
            "-m" (expand-file-name "~/.local/share/whisper-models/ggml-small.en.bin")
            "-l" whisper-language
            "-np"
            "-nt"
            "-f" file))
  (setq whisper-insert-text-at-point-function #'insert))

Links:

Whisper-Cpp build with Vulkan https://github.com/NapoleonWils0n/cerberus/blob/master/whisper-cpp/whisper-cpp-vulkan-freebsd.org

Emacs init.el whisper.el https://github.com/NapoleonWils0n/freebsd-dotfiles-xps/blob/master/.config/emacs/init.el#L1613

whisper.cpp https://github.com/ggml-org/whisper.cpp

Sacha Chua's fork of whisper.el https://github.com/sachac/whisper.el

Sacha Chua's blog post https://sachachua.com/blog/2026/01/using-whisper-el-to-capture-text-to-speech-in-emacs/

Yay Emacs live-coding: whisper.el
View: https://www.youtube.com/watch?v=LtfxMFW0574


Sacha Chua's dotfiles https://sachachua.com/dotemacs/index.html#multimedia-whisper https://github.com/sachac/.emacs.d

Freebsd dotfiles https://github.com/NapoleonWils0n/freebsd-dotfiles-xps

Freebsd root dotfile https://github.com/NapoleonWils0n/freebsd-root-xps
 
Back
Top