fix(live-dictate): pick the real microphone and add a diagnose command

Dictation was silent even with a working server: avfoundation index 0 on
this machine is "Microsoft Teams Audio", a virtual driver that records
pure digital silence, and the device was hard-wired to ":0".

- resolve the input device on darwin by name instead of by index, since
  indices shift as devices appear and disappear; prefer
  live-dictate-device-name-pattern (built-in microphone) and skip
  virtual/loopback drivers matched by live-dictate-ignore-device-name
- allow the device to be pinned either as a raw index (":2") or as a
  regexp matched against the reported device names
- announce the selected device when dictation starts and name it in the
  silence warning
- add `live-dictate-stop' as an explicit command (the keybinding stays a
  toggle: SPC A d starts and stops)
- add `live-dictate-diagnose', which lists the devices, records two
  seconds and reports whether the chosen one delivers audio or digital
  silence (the latter means the OS microphone permission is missing)

config-mac.el stops pinning ":0" and documents the auto-selection.
This commit is contained in:
Willem van den Ende
2026-11-05 12:26:14 +00:00
parent 580b213793
commit ffa95852c0
2 changed files with 152 additions and 31 deletions
+8 -4
View File
@@ -269,10 +269,14 @@ Returns answer with org-roam links to sources."
whisper-translate nil ; whisper.cpp translates only via server --translate flag
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.
;; live-dictate picks the microphone by name on darwin: avfoundation indices
;; shift as devices come and go, and index 0 here is "Microsoft Teams Audio",
;; a virtual driver that records nothing but silence. Leave the device nil to
;; auto-select the built-in microphone, or pin one by index or by regexp:
;; (setopt live-dictate-ffmpeg-input-device ":2") ; index
;; (setopt live-dictate-ffmpeg-input-device "melliw phone Microphone") ; name
;; First use will trigger the macOS microphone permission prompt for Emacs.
(with-eval-after-load 'live-dictate
(setopt live-dictate-ffmpeg-input-device ":0"))
(setopt live-dictate-debug nil))
;;; config-mac.el ends here