SwiftMac now supports routing speech and notifications to different physical audio devices!
Emacspeak spawns two separate swiftmac processes:
- Speech Process: Handles regular speech output
- Notification Process: Handles notification/auditory icon output
Each process can be configured to use a different audio device and channel.
Add these environment variables BEFORE loading emacspeak:
(use-package emacspeak
:ensure nil
:init
(setopt load-path (cons "~/.emacspeak/lisp" load-path))
(setopt emacspeak-directory "~/.emacspeak")
;; Configure multi-device routing
;; Speech -> Audioengine D1 (device 125), both channels
(setenv "SWIFTMAC_SPEECH_DEVICE_AND_CHANNEL" "125:both")
;; Notifications -> LG Ultra HD (device 110), left channel only
(setenv "SWIFTMAC_NOTIFICATION_DEVICE_AND_CHANNEL" "110:left")
:config
(setopt dtk-program "swiftmac")
;; Enable notification server (spawns second swiftmac process)
(setopt tts-notification-device "notify")
(require 'emacspeak-setup))When tts-notification-device is set to a non-default value:
-
Speech Process (main):
- Started normally by Emacspeak
- Reads
SWIFTMAC_SPEECH_DEVICE_AND_CHANNEL - Outputs to configured speech device
-
Notification Process:
- Spawned by
dtk-notify-initialize - Emacspeak automatically sets
SWIFTMAC_AUDIO_TARGETto the value oftts-notification-device - Now also sets
SWIFTMAC_NOTIFICATION_SERVER=1(triggers notification routing) - Reads
SWIFTMAC_NOTIFICATION_DEVICE_AND_CHANNEL - Outputs to configured notification device
- Spawned by
Run this command to list available audio devices:
make list-devicesExample output:
DeviceID: 110 | "LG Ultra HD" | Channels: 2
Config (both channels): 110:both
Config (left only): 110:left
Config (right only): 110:right
[DEFAULT] DeviceID: 125 | "Audioengine D1" | Channels: 2
Config (both channels): 125:both
Config (left only): 125:left
Config (right only): 125:right
SWIFTMAC_*_DEVICE_AND_CHANNEL="<deviceID>:<channel>"
- deviceID: Numeric ID from
make list-devices(or 0 for system default) - channel:
left,right, orboth
Simple test in Emacs:
;; Test speech (should come from speech device)
(dtk-speak "This is speech")
;; Test notification (should come from notification device)
(emacspeak-auditory-icon 'select-object);; Speech to headphones, notifications to speakers
(setenv "SWIFTMAC_SPEECH_DEVICE_AND_CHANNEL" "125:both")
(setenv "SWIFTMAC_NOTIFICATION_DEVICE_AND_CHANNEL" "89:both");; Both to headphones, but speech in both ears, notifications in left only
(setenv "SWIFTMAC_SPEECH_DEVICE_AND_CHANNEL" "125:both")
(setenv "SWIFTMAC_NOTIFICATION_DEVICE_AND_CHANNEL" "125:left");; Don't set tts-notification-device, or set to "default"
(setopt tts-notification-device "default")Problem: Both speech and notifications come from same device
- Check that
tts-notification-deviceis set to a non-default value (e.g., "notify", "left", or "right") - Verify environment variables are set BEFORE
(require 'emacspeak-setup)
Problem: No audio at all
- Run
make list-devicesto verify device IDs are correct - Check device IDs haven't changed (can happen after system updates)
- Try device ID 0 (system default) to test
Problem: Emacspeak says "notification mode on" but using wrong device
- The notification server needs
SWIFTMAC_NOTIFICATION_SERVER=1to be set - This should be automatic when Emacspeak spawns the notification process
- Check if you're running an updated version of emacspeak/dtk-speak.el