feat(mac): port whisper/live-dictate speech-to-text from Linux
Mirror the config-linux.el block so both machines have the same
capabilities. packages.el already declares whisper and websocket, and
lisp/live-dictate.el already picks avfoundation for FFmpeg input on
darwin; this adds the use-package! whisper block, the SPC A leader
keys, the live-dictate autoload, and the mac-specific audio input
device (":0" = no video, default microphone, TCC permission prompt on
first use).
Still needs a backend on this machine: an OpenAI-compatible
transcription server on localhost:13305 (Lemonade as on Linux, or
whisper.cpp's server, or a remote host). Until then the commands bind
but fail to connect.
Verified statically on the mac only (parens); runtime needs doom sync.
This commit is contained in:
@@ -233,4 +233,43 @@ Returns answer with org-roam links to sources."
|
||||
(setq org-roam-export-blog-firehose-root "~/dev/elixir/firehose"
|
||||
org-roam-export-jekyll-root "~/MyDocuments/qwan/sites/qwaneu.github.io")
|
||||
|
||||
;;; Speech-to-text (whisper.el + streaming dictation)
|
||||
;;
|
||||
;; Ported from config-linux.el so both machines have the same capabilities.
|
||||
;; The pieces are already cross-platform: `whisper' and `websocket' are
|
||||
;; declared in shared packages.el, and lisp/live-dictate.el picks avfoundation
|
||||
;; for FFmpeg input on darwin by itself. What this machine still needs is a
|
||||
;; backend: an OpenAI-compatible transcription server listening on
|
||||
;; localhost:13305 (as on Linux) -- see the checklist in agent-start-here.md
|
||||
;; or the comment in config-linux.el. Until one runs, these commands bind
|
||||
;; but fail to connect; point `whisper-openai-api-baseurl' and
|
||||
;; `live-dictate-server-url' elsewhere to use a remote backend.
|
||||
(add-load-path! "lisp")
|
||||
(autoload #'live-dictate "live-dictate" nil t)
|
||||
|
||||
(use-package! whisper
|
||||
:commands (whisper-run whisper-file whisper-select-language)
|
||||
:init
|
||||
(map! :leader
|
||||
(:prefix ("A" . "+ai")
|
||||
:desc "Whisper record/transcribe" "w" #'whisper-run
|
||||
:desc "Whisper transcribe file" "W" #'whisper-file
|
||||
:desc "Whisper select language" "l" #'whisper-select-language
|
||||
:desc "Live dictate (streaming)" "d" #'live-dictate))
|
||||
:config
|
||||
(setopt whisper-install-whispercpp nil ; no whisper.cpp needed, remote API only
|
||||
whisper-server-mode 'openai ; use OpenAI-compatible transcription API
|
||||
whisper-openai-api-baseurl "http://localhost:13305/"
|
||||
whisper-openai-api-key "not-needed" ; Lemonade ignores auth, but whisper.el requires a non-nil key
|
||||
whisper-openai-model "Whisper-Large-v3-Turbo"
|
||||
whisper-language "en"
|
||||
whisper-translate nil ; t would POST to /translations instead
|
||||
whisper-return-cursor 'end))
|
||||
|
||||
;; live-dictate's avfoundation input needs an explicit `-i' of the form
|
||||
;; "<video-index>:<audio-index>"; ":0" means no video, default microphone.
|
||||
;; First use will trigger the macOS microphone permission prompt.
|
||||
(with-eval-after-load 'live-dictate
|
||||
(setopt live-dictate-ffmpeg-input-device ":0"))
|
||||
|
||||
;;; config-mac.el ends here
|
||||
|
||||
Reference in New Issue
Block a user