I\'m not blind, I just want to have a way to have my Windows machine read the contents of a buffer outloud. Here are the basic requirements:
I have a simple solution based on the Python pyttsx module. This starts a python script as an emacs process and sends it strings to be read out.
(defvar tts nil "text to speech process")
(defun tts-up ()
(interactive)
(and (not (null tts))
(eq (process-status tts) 'run)))
(defun tts-start ()
(interactive)
(if (not (tts-up))
(setq tts
(start-process "tts-python"
"*tts-python*"
"python" "speak.py"))))
(defun tts-end ()
(interactive)
(delete-process tts)
(setq tts nil))
(defun tts-say (text)
(interactive)
(tts-start)
(process-send-string tts (concat text "\n")))
The python file speak.py:
import pyttsx
engine = pyttsx.init()
def say(data):
engine.say(data)
engine.runAndWait()
while True:
say(raw_input())