While Mac OSX 10.11.5 (El Capitan) has the "say" command to speak in a system generated voice, or so to say, is there any command that is similar for Python that can be used in Python? If Subprocess is utilized, please explain on how to use that.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
You can use subprocess as follows:
Thank you everyone for the quick replies. I have been playing with the subprocess module, and I have gotten this to work:
import subprocess m=subprocess.Popen(["say","hello"]) print(m)
The .Popen command is also a quick way to get this to work. However, this is only working on my Mac and I need it to work on my Raspberry Pi for an interactive feature in my code. (I am using Pi Cam and Infrared Sensors for a robot that wheels around and when it senses people in front of it, says "Hey! Please move out of my way please!"PyTTSx package will help you with this. PyTTSx is a Python package supporting common text-to-speech engines on Mac OSX, Windows, and Linux.
Speaking text
See more examples here