12

My code:

import pyttsx3
import random

engine = pyttsx3.init()
words = ['hello', 'word']     
engine.say(random.choice(words)) #Say these words slower

I don't want it to go really slow just slow enough to be easy for a non native speaker to undersatnd the words in the words list. Also if it is impossible to do it using the pyttsx module can you suggest a module that can do that?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
reanuk
  • 117
  • 1
  • 2
  • 7

4 Answers4

15
newVoiceRate = 145
engine.setProperty('rate',newVoiceRate)
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Sarborup Sarkar
  • 151
  • 1
  • 2
6

Try this:

engine.setProperty('rate', newVoiceRate)

Replace newVoiceRate with rate according to requirement. It's integer speech rate in words per minute. Defaults to 200 word per minute.

Ali Yılmaz
  • 1,657
  • 1
  • 11
  • 28
Rahul Vansh
  • 171
  • 2
  • 13
3

To make the voice go slower in pyttsx3 you can just do:

import pyttsx3   

text = "Hello"
 
engine = pyttsx3.init()
engine.setProperty("rate", rate)
engine.say(text)
engine.runAndWait()

2

First We Have To Make A Variable Which defines the rate of speed the engine have to speak the (engine.setProperty) sets The Property of the rate to the variable (newVoiceRate) By That You Can change The Speed of speaking speed of the engine. I have Also Edited your codes and implied the changes. See below Try This

 import pyttsx3
 import random

 engine = pyttsx3.init()
 words = ['hello', 'word']     
 engine.say(random.choice(words))
 newVoiceRate = 145
 engine.setProperty('rate',newVoiceRate)
Harish R
  • 21
  • 3
  • While this code may provide a solution to the question, it's better to add context as to why/how it works. This can help future users learn, and apply that knowledge to their own code. You are also likely to have positive feedback from users in the form of upvotes, when the code is explained. – borchvm Aug 12 '20 at 08:08
  • Thanks for Sharing Your Feedback next time I will try to improve answers – Harish R Aug 12 '20 at 14:13
  • I Have Edited the Answer and Now it is perfect. If You Like my Answers Please see my profile once Becouse I am a beginner in Programming – Harish R Aug 12 '20 at 14:35