Text to Speech in Emacs

I'm not blind, I just want my windows machine to read the contents of the outloud buffer. Here are the basic requirements:

  • Read any text buffer in English.
  • Pause reading at any time and resume it at any time (do not wait a few minutes for the large buffer to finish when someone enters my office).
  • Adjust the reading speed during playback.
  • Select the text that is currently being read (optional)

I found a couple of possible solutions:

  • Emacspeak : Designed for the Blind. Looks like a standalone program, not an Emacs plugin.
  • festival.el : A festival is required. I can not find Windows Binaries for the festival. Anybody have?
  • I could write my own. There are many Text-To-Speech (TTS) libraries today. The interactive pause function may be the biggest trick, but there should be some libraries that can do this.

Which option is the best plan? I don't need a weekly project here. Compiling the festival on Windows was a painful experiment. Emacspeak looks like redundant what I want.

+6
emacs text-to-speech festival
source share
2 answers

Festival for Windows is available here . I can not guarantee that festival.el will work with these binaries. However, I have experience with these binaries, so if you have problems working with them outside Emacs, I can help.

I do not think that you will have control over the playback speed with the festival, although I could be wrong. Regarding maintaining control over him, I would say that it is best to program it so that he sends only small portions to the festival. Otherwise, there really is no way to prevent it from reading until completion.

Basically, I don’t think there is anything there that would meet your minimum requirements without any work.

Edit: after I look back at your requirements, I would say that the best approach would be to hack into festival.el in order to send an offer to the Festival at the same time. You can then program a keystroke that will kill him so that it only finishes the current sentence. At the same time, your script may highlight the sentence that is currently being sent to the festival.

+6
source share

I have a simple solution based on the pyttsx Python module . This runs the python script as an emacs process and sends it for reading.

(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"))) 

Python speak.py file:

 import pyttsx engine = pyttsx.init() def say(data): engine.say(data) engine.runAndWait() while True: say(raw_input()) 
+1
source share

All Articles