Rao Rao - 6 months ago 55
Python Question

How to convert text to speech in python

I would like to now how to convert text to speech in python.

In .NET i used

Dim SAPI

Msg = 'Hi this is a test'

SAPI = CreateObject("sapi.spvoice")
SAPI.Speak(Msg)

Answer

You can achieve it by pyttsx module. it uses default MS speech recognition system.

import pyttsx

engine = pyttsx.init()
engine.say("Your Message")
engine.runAndWait()