0

I'm trying to use pyttsx for text to speech on windows 7 but it does not produce any speech.

Import pyttsx
Engine=pyttsx.init('sapi5')
Engine.say('hello')

This is my code no error and exceptions are coming but there is no text to speech conversion

Steve
  • 134
  • 1
  • 15

3 Answers3

1

Python is a case sensitive language, and must be installed on your machine for you to use this library. If/when Python is set up on your Windows 7 machine, try this code:

import pyttsx
engine=pyttsx.init() # The init function doesn't take any parameters 
engine.say("hello") #I prefer double quotes, but single quotes work too

There's a list of examples here: https://pyttsx.readthedocs.io/en/latest/engine.html#examples

aoa4eva
  • 66
  • 5
1

You also have to add this to the final line.

Engine.runAndWait()
Chris Farr
  • 3,580
  • 1
  • 21
  • 24
0

You may try these:

import pyttsx
engine = pyttsx.init()
engine.say('hello')
engine.runAndWait()
lofihelsinki
  • 2,491
  • 2
  • 23
  • 35