'Unable to change voice in pyttsx3
I checked out a similar question but it still couldn't solve my issue. I wanted to put a female voice or just change the pitch of it. Few people suggested to change the voice id, further referring that 0 defined male voice while 1 defined female.
Although, Trying out both voice ids, I get a regular male voice only,
Is it possible to chance the pitch of the voice for all pc's, as somebody referred it to as a PC audio problem, but in other language voice recognitions my PC works with different gender voices perfectly.
I also need to give gaps between each word, as in the regular voice, it speaks so fast, that the user has chances of not understanding a thing. If aware on how do the same, please tell me.
This is a code snippet on what I'm trying to work on:
import pyttsx3 #pip install pyttsx
engine=pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
engine.setProperty('voice','voices[1].id')
def speak(text):
engine.say(text)
engine.runAndWait()
Solution 1:[1]
Try this code. I hope it works:
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
print(voice, voice.id)
engine.setProperty('voice', voice.id)
engine.say("Hello, world.")
engine.runAndWait()
engine.stop()
This should give you a list of voices.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | General Grievance |
