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?
The pyttsx3 module supports two voices first is female and the second is male which is provided by “sapi5” for windows.
On the run of the python file, the voiceChange() function is invoked. Inside the function, an instance is initialized of the module. In the voices library, we get the available voices, and then using the setProperty() method, we change the voice id accordingly to bring a male or female voice.
newVoiceRate = 145
engine.setProperty('rate',newVoiceRate)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With