Open wickedjargon opened 6 years ago
Here's a function to speak the active region, assuming you have espeak installed and accessible from Emacs:
(defun speak-my-text () "Speaks text in buffer."
(interactive)
(if (region-active-p)
(progn
(kill-ring-save (region-beginning) (region-end))
(start-process-shell-command "speakbuffvar" nil
"bash -c \"killall espeak;xsel --clipboard|espeak -s 290\""))
(progn
(kill-ring-save (point-min) (point-max))
(start-process-shell-command "speakbuffvar" nil
"bash -c \"killall espeak;xsel --clipboard|espeak -s 290\""))))
Tested on Ubuntu, but should work on OSX, possibly with a tweak or two. Let me know if you can't get it working and I'll try to help. Remember that espeak will need to be accessible from your shell in Emacs.
PS Just thinking this might not work on OSX because xsel doesn't work without running an x server. If you're on OSX, let me know and I'll try writing something that works for you. Also, if you're reading a text file, how do you define paragraph? I don't think Emacs has any functionality for moving between paragraphs. Go to next blank line?
i'm not interested in any of the automatic speaking features. I'd like to turn those off (the ones demonstrated in the video). I'd like to two features: 'speak region' and 'speak next paragraph'